public class Tank extends FaGame{
//尺寸,方向,速度
private int width = 40;
private int height = 50;
private int speed = 3;
private Direction direction = Direction.UP;
//四个方向图片
private String upimg;
private String downimg;
private String leftimg;
private String rightimg;
//坦克类的构建函数
public Tank (全部args){
super(img,x,y,Game);
this.args = args
}
//上下左右四个方法
while(up){
public void upward(){
y -=speed;
setimg(upimg);
direction = Direction.UP;
}
}
//创建setimg方法
public void setimg(String img){
this.img = Toolkit.getDefaultToolkit().getImage(img);
}
//Override 分别重写父类FaGame两个方法
}
坦克类增加上下左右移动四个方法
最新推荐文章于 2024-08-16 23:08:28 发布