⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cbao.java

📁 J2ME写的一个潜艇大战游戏!!!!!!!!!
💻 JAVA
字号:
/*
 * CBao.java
 *
 * Created on 2006年5月15日, 下午7:01
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package gamepacket;

import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;

/**
 *
 * @author zxh
 */
public class CBao
{
    
    public Sprite spt_bao;
    private int index;//索引号
    private int dx,dy;
    private boolean IsShow;
    private long tempTime;
    
    /**
	 * Creates a new instance of CBao
	 */
    public CBao (LayerManager lm)
    {
	IsShow=false;
	index=0;
		try
		{
			spt_bao=new Sprite(Image.createImage ("/img/bao.png"),20,20);//加载爆炸图
		} catch (IOException ex){}
		spt_bao.setVisible (false);//初始不可见
		lm.append (spt_bao);
    }
    
    
    
    public void ShowBao(long startTime)
    {
	if(IsShow==true)
	{
	    if(startTime-tempTime>100)
	    {
		if(++index>5)
		{
		    index=0;
		    IsShow=false;
		    spt_bao.setVisible (false);
		}
		spt_bao.setFrame (index);
		tempTime=System.currentTimeMillis ();
	    }
	    
	}
	
    }
    
    public void SetShow(boolean show)
    {
	index=0;
	IsShow=show;
	spt_bao.setVisible (true);
    }
    public void SetPoint(int x,int y)
    {
	dx=x;
	dy=y;
	spt_bao.setPosition (dx,dy);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -