@Override
public void run() {
while(true){
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(isShot){
switch (direct) {
case 0://向上
y -= speed;
break;
case 1://下
y += speed;
break;
case 2://右
x -= speed;
break;
case 3://左
x += speed;
break;
default:
break;
}
}
//System.out.println(x + " " + y);
if(x < 0 || x > 400 || y < 0 || y > 300){
//System.out.println("this.islive = false");
this.isLive = false;
break;
}
}
}
}
Java游戏开发之坦克大战代码(9)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/34fa2e4cb3df2ac646cd1064dd4540ad.html