From 34ab1bc4401b280ca343dfa361a043bf7d1bb933 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Mon, 23 May 2016 21:06:55 -0400 Subject: [PATCH] Tank class update Bullet class updated to include width, height field added for enemy --- src/tanks/Tanks.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/tanks/Tanks.java b/src/tanks/Tanks.java index 75e6f6b..b2560dc 100644 --- a/src/tanks/Tanks.java +++ b/src/tanks/Tanks.java @@ -16,7 +16,11 @@ public class Tanks //fields private JFrame frame; private JPanel panel; + + //game elements private ArrayList bullets; + private Player p; + private ArrayList enemy; //constructor public Tanks() @@ -76,8 +80,12 @@ public class Tanks private class Bullet extends RotationalElement { + public boolean enemyBullet; // whether it is an enemy or player bullet + public Bullet(RotationalElement e) { + width = 25; + height = 25; x = e.x; //Change this coordinate to the player's location y = e.y; //Change this coordinate to the player's location direction = e.direction; //Change this coordinate to the player turret's angle @@ -98,11 +106,11 @@ public class Tanks { bullets.remove(this); //" " } + + //checks for collision for with enemies + } - - - - + } /*