删除set方法

master
kn5886348135 3 years ago
parent 3d66296c44
commit 22a515741c

@ -28,8 +28,8 @@ public class Tank {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.dir = dir; this.dir = dir;
this.tf = tf;
this.group = group; this.group = group;
this.tf = tf;
} }
public void fire(){ public void fire(){
@ -46,18 +46,6 @@ public class Tank {
return x; return x;
} }
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Group getGroup() { public Group getGroup() {
return group; return group;
} }
@ -66,6 +54,10 @@ public class Tank {
this.group = group; this.group = group;
} }
public int getY() {
return y;
}
public boolean isMoving() { public boolean isMoving() {
return moving; return moving;
} }

@ -17,7 +17,7 @@ public class TankFrame extends Frame {
List<Bullet> bullets = new ArrayList<>(); List<Bullet> bullets = new ArrayList<>();
List<Tank> tanks = new ArrayList<>(); List<Tank> tanks = new ArrayList<>();
public static final int GAME_WIDTH = 800,GAME_HEIGHT=600; static final int GAME_WIDTH = 800,GAME_HEIGHT=600;
public TankFrame() { public TankFrame() {
setSize(GAME_WIDTH, GAME_HEIGHT); setSize(GAME_WIDTH, GAME_HEIGHT);
@ -133,6 +133,7 @@ public class TankFrame extends Frame {
} }
private void setMainTankDir() { private void setMainTankDir() {
if (!bL && !bU && !bR && !bD) { if (!bL && !bU && !bR && !bD) {
myTank.setMoving(false); myTank.setMoving(false);
} else { } else {

Loading…
Cancel
Save