From 90d7c933ba68f18ceed487246fd9bc8c57a90b8b Mon Sep 17 00:00:00 2001 From: kn5886348135 <56352848+kn5886348135@users.noreply.github.com> Date: Sat, 19 Nov 2022 17:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/tankbattle/Bullet.java | 12 +++++++++--- src/main/java/com/example/tankbattle/Tank.java | 7 +++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/example/tankbattle/Bullet.java b/src/main/java/com/example/tankbattle/Bullet.java index 77ffab4..f5a3b09 100644 --- a/src/main/java/com/example/tankbattle/Bullet.java +++ b/src/main/java/com/example/tankbattle/Bullet.java @@ -11,9 +11,7 @@ public class Bullet { private Dir dir; private boolean living = true; - - private TankFrame tf = null; - + TankFrame tf = null; private Group group = Group.BAD; public Bullet(int x, int y, Dir dir, Group group, TankFrame tf) { @@ -24,6 +22,14 @@ public class Bullet { this.tf = tf; } + public Group getGroup() { + return group; + } + + public void setGroup(Group group) { + this.group = group; + } + public void paint(Graphics g) { if (!living) { tf.bullets.remove(this); diff --git a/src/main/java/com/example/tankbattle/Tank.java b/src/main/java/com/example/tankbattle/Tank.java index 0ddc223..7a0d133 100644 --- a/src/main/java/com/example/tankbattle/Tank.java +++ b/src/main/java/com/example/tankbattle/Tank.java @@ -105,15 +105,14 @@ public class Tank { move(); } + public void setDir(Dir dir) { + this.dir = dir; + } public void setMoving(boolean moving) { this.moving = moving; } - public void setDir(Dir dir) { - this.dir = dir; - } - public void setX(int x) { this.x = x; }