simpletank.java
来自「J2ME超级坦克大战源码」· Java 代码 · 共 30 行
JAVA
30 行
//------------------------------------------------------------------------------
public class SimpleTank extends EnemyTank{
protected SimpleTank(boolean hasPrize) {
super(hasPrize);
score=Score.SCORE_100;
}
public void think(){
//Move blindly.
int changeDirection=Math.abs(rnd.nextInt()) % 100;
if(changeDirection>90){
direction =Math.abs(rnd.nextInt()) % 4;
}else if(changeDirection>80){
direction =BattleField.SOUTH;
}
int shooting=Math.abs(rnd.nextInt()) % 100;
shoot=false;
//shooting blindly.
if(shooting>=50) {
shoot=true;
}
super.think();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?