场景中障碍物的开发
1. 所包含的属性:
① 坐标(X,Y)
② 显示的图片
③ 类型
④ 初始的类型
2. 拥有的方法:
① 重置障碍物的方法
② 改变障碍物的显示图片(依据障碍物的类型)
public class Obstruction {
//初始坐标
private int x;
private int y;
//类型
private int type;
//初始的类型
private int startType;
//显示图片
private BufferedImage showImage=null;
public Obstruction(int x, int y, int type) {
super();
this.x = x;
this.y = y;
this.type = type;
setImage();
}
//重置方法
public void reset(){
//修改类型为初始类型
this.type=startType;
//改变显示图片
this.setImage();
}
//根据类型改变图片
public void setImage(){
showImage=StaticValue.allObstructionImage.get(type);
}
}