diff --git a/src/tanks/DrawableElement.java b/src/tanks/DrawableElement.java index 7a652ac..955fc40 100644 --- a/src/tanks/DrawableElement.java +++ b/src/tanks/DrawableElement.java @@ -32,12 +32,13 @@ public abstract class DrawableElement img = null; try { + System.out.println(imageLocation); img = ImageIO.read(getClass().getResourceAsStream(imageLocation)); //img = ImageIO.read(new File(imageLoc)); } catch(IOException e) { - System.out.println(e.toString()); + //System.out.println(e.toString()); } } } diff --git a/src/tanks/RotationalElement.java b/src/tanks/RotationalElement.java index 0bbd8dd..6dbbcfd 100644 --- a/src/tanks/RotationalElement.java +++ b/src/tanks/RotationalElement.java @@ -66,8 +66,8 @@ public abstract class RotationalElement extends GameElement @Override public void setShape() { - AffineTransform rotate = AffineTransform.getRotateInstance(degToRad(), x, y); + AffineTransform rotate = AffineTransform.getRotateInstance(degToRad(), x + width /2, y + height /2); - shape = new Area(rotate.createTransformedShape(new Rectangle(x,y,width, height))); + shape = new Area(rotate.createTransformedShape(new Rectangle(x,y ,width, height))); } } diff --git a/src/tanks/Tanks.java b/src/tanks/Tanks.java index f19b96d..018620b 100644 --- a/src/tanks/Tanks.java +++ b/src/tanks/Tanks.java @@ -23,8 +23,8 @@ public class Tanks //fields private JFrame frame; private JPanel panel; - private int fheight=500; - private int fwidth=800; + private int fheight=650; + private int fwidth=900; private Timer move; private KeyListener key; @@ -229,7 +229,10 @@ public class Tanks } else if(id==KeyEvent.VK_SPACE) { - shoot(); + if(pressed) + { + shoot(); + } } } @@ -261,7 +264,7 @@ public class Tanks health = 10; isAlive=true; speed = 3; - imageLocation = "player.png"; + imageLocation = "zombie.png"; super.loadImage(); } //uses super to move player if collision then removes zombie and player @@ -397,7 +400,10 @@ public class Tanks gameMode=1; waveNum=1; - //actionlistener calls spawn every 2 seconds + imageLocation = "wave.jpg"; + super.loadImage(); + + //actionlistener calls spawn every 2 seconds ActionListener s = new ActionListener() { @@ -429,11 +435,6 @@ public class Tanks { newGameMode=gameMode; } - public void draw(Graphics g) - { - g.setColor(Color.yellow); - g.fillRect(0, 0, 500, 500); - } //spawn method checks if spawn timer ==0 and if so then spawns an @@ -441,9 +442,9 @@ public class Tanks public void spawn() { - Enemy temp = new Zombie(); - temp.spawn(frame); - enemy.add(temp); + Enemy temp = new Zombie(); + temp.spawn(frame); + enemy.add(temp); } diff --git a/src/tanks/wave.jpg b/src/tanks/wave.jpg new file mode 100644 index 0000000..4a63df1 Binary files /dev/null and b/src/tanks/wave.jpg differ diff --git a/src/tanks/zombie.png b/src/tanks/zombie.png new file mode 100644 index 0000000..b3d195d Binary files /dev/null and b/src/tanks/zombie.png differ