bombcommand.java
来自「J2ME飞机设计游戏,希望对学习J2ME的程序员有所帮助」· Java 代码 · 共 30 行
JAVA
30 行
public class BombCommand implements Command {
public BombCommand(){
world = World.getInstance();
planeActor = BattlePlaneActor.getInstance();
}
public void execute(int xPos, int yPos) {
if (planeActor.getBattle_magic() >= 60) {
// 产生爆炸效果
world.newBullet(7, xPos, yPos - (48 << 8), 9 << 8, 0);
world.newBullet(7, xPos, yPos - (48 << 8), -9 << 8, 0);
world.newBullet(7, xPos, yPos - (48 << 8), 0, 9 << 8);
world.newBullet(7, xPos, yPos - (48 << 8), 0, -9 << 8);
world.newBullet(7, xPos, yPos - (48 << 8), 6 << 8, 6 << 8);
world.newBullet(7, xPos, yPos - (48 << 8), -6 << 8, 6 << 8);
world.newBullet(7, xPos, yPos - (48 << 8), -6 << 8, -6 << 8);
world.newBullet(7, xPos, yPos - (48 << 8), 6 << 8, -6 << 8);
//产生虚拟爆炸对象
world.newBullet(12, xPos - (45<<8), yPos - (93 << 8), 0, 0); //设置爆炸的左上顶点坐标
//planeActor.setBattle_magic(planeActor.getBattle_magic() - 60); // 消耗魔法值
}
}
private World world;
private BattlePlaneActor planeActor;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?