📄 ccpubomb.java
字号:
/*
* CCpuBomb.java
*
* Created on 2006年4月16日, 下午2:43
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package gamepacket;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
/**
*
* @author zxh
*/
public class CCpuBomb
{
//敌人炸弹图
public Sprite spt_cpubomb;
private boolean IsShow;//炸弹是否已经发射
private int dx,dy;
private int Speed;//速度
private int width,height;//屏幕大小
/** Creates a new instance of CCpuBomb */
public CCpuBomb (int scrWidth,int scrHeight,LayerManager lm)
{
Speed=1;//初始速度1
IsShow=false;
width=scrWidth;
height=scrHeight;
try
{
spt_cpubomb=new Sprite(Image.createImage ("/img/cpubomb.png"));//敌人炸弹
} catch (IOException ex){}
lm.append (spt_cpubomb);
spt_cpubomb.setVisible (false);
}
public void Move ()//
{
if(IsShow==true)
{dy-=Speed;//向下移动
spt_cpubomb.setVisible (true);
spt_cpubomb.setPosition (this.dx,this.dy);
}
if(dy<80)
{
IsShow=false;
spt_cpubomb.setVisible (false);//炸弹不可见
}
}
public boolean IsOver(CPlayerShip playership)
{
//碰撞检测
if(spt_cpubomb.collidesWith (playership.spt_playership,true))
{
spt_cpubomb.setVisible (false);//炸弹图片不可见
this.IsShow=false;//炸弹不可见
return true;
}
else
{
return false;
}
}
public void SetPoint(int x,int y)
{
dx=x;
dy=y;
}
public void SetShow(boolean show)
{
IsShow=show;
}
public boolean GetShow()
{
return IsShow;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -