diff --git a/src/main/java/com/msb/TankDemo.java b/src/main/java/com/msb/TankDemo.java index 725b1a8..bbe5b64 100644 --- a/src/main/java/com/msb/TankDemo.java +++ b/src/main/java/com/msb/TankDemo.java @@ -13,7 +13,7 @@ public class TankDemo { //现实当中,虽然可以过按键来改变方块的坐标并且重新刷新画板来实现移动,但是敌方的坦克应该是自动在跑 while (true) { // Thread.sleep(50); - Thread.sleep(1000); + Thread.sleep(500); tankFrame.repaint(); } } diff --git a/src/main/java/com/msb/decorator/RectDecorator.java b/src/main/java/com/msb/decorator/RectDecorator.java index 1a02426..113eb7f 100644 --- a/src/main/java/com/msb/decorator/RectDecorator.java +++ b/src/main/java/com/msb/decorator/RectDecorator.java @@ -24,8 +24,10 @@ public class RectDecorator extends GODecoratory { @Override public void paint(Graphics g) { - this.x = gameObject.x; - this.y = gameObject.y; + /*this.x = gameObject.x; + this.y = gameObject.y;*/ + this.x = super.gameObject.x; + this.y = super.gameObject.y; gameObject.paint(g); //原来的样式 //需要装饰的样式 @@ -45,4 +47,5 @@ public class RectDecorator extends GODecoratory { public int getHeight() { return super.gameObject.getHeight(); } + } diff --git a/src/main/java/com/msb/decorator/TailDecorator.java b/src/main/java/com/msb/decorator/TailDecorator.java index c7d3cd2..38f595d 100644 --- a/src/main/java/com/msb/decorator/TailDecorator.java +++ b/src/main/java/com/msb/decorator/TailDecorator.java @@ -24,8 +24,10 @@ public class TailDecorator extends GODecoratory { @Override public void paint(Graphics g) { - this.x = gameObject.x; - this.y = gameObject.y; + /*this.x = gameObject.x; + this.y = gameObject.y;*/ + this.x = super.gameObject.x; + this.y = super.gameObject.y; gameObject.paint(g); //原来的样式 //需要装饰的样式 @@ -46,4 +48,5 @@ public class TailDecorator extends GODecoratory { public int getHeight() { return super.gameObject.getHeight(); } + } diff --git a/src/main/java/com/msb/inter/impl/FourFireStrategy.java b/src/main/java/com/msb/inter/impl/FourFireStrategy.java index 5134847..7a555d3 100644 --- a/src/main/java/com/msb/inter/impl/FourFireStrategy.java +++ b/src/main/java/com/msb/inter/impl/FourFireStrategy.java @@ -6,6 +6,7 @@ package com.msb.inter.impl;/** */ import com.msb.model.Bullet; +import com.msb.model.GameModel; import com.msb.model.Tank; import com.msb.enums.DirEnum; import com.msb.inter.FireStrategy; @@ -25,6 +26,7 @@ public class FourFireStrategy implements FireStrategy { for (DirEnum value : DirEnum.values()) { // new Bullet(bX, bY, value, tank.getGroup(), tank.getGameModel()); new Bullet(bX, bY, value, tank.getGroup()); +// GameModel.INSTANCE.add(new Bullet(bX, bY, value, tank.getGroup())); } } }