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
}
//上下左右四个方法
public void upward(){
y -=speed;
setimg(upimg);
direction = Direction.UP;
}
//创建setimg方法
public void setimg(String img){
this.img = Toolkit.getDefaultToolkit().getImage(img);
}
//发射方法
public void attack(){
Point p = this.getHeadPoint();
Bullet bullet = new Bullet("子弹图片地址",p.x,p.y,this.youxi,this.direction);
//把子弹加入游戏类的子弹集合
this.Game.bulletlist.add(bullet)
}
//定义子弹原始坐标的方法
public Point getHeadPoint(){
switch(direction){
case UP:
return new Point (x+width/2,y)
}
}
//Override 分别重写父类FaGame两个方法
}