diff --git a/.gitignore b/.gitignore index 46cba4a..a568390 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /nbproject/private/ -/build/ \ No newline at end of file +/build/ +/dist/ \ No newline at end of file diff --git a/src/tanks/DrawableElement.java b/src/tanks/DrawableElement.java index 955fc40..c82cb37 100644 --- a/src/tanks/DrawableElement.java +++ b/src/tanks/DrawableElement.java @@ -32,7 +32,7 @@ public abstract class DrawableElement img = null; try { - System.out.println(imageLocation); + //System.out.println(imageLocation); img = ImageIO.read(getClass().getResourceAsStream(imageLocation)); //img = ImageIO.read(new File(imageLoc)); } diff --git a/src/tanks/Tanks.java b/src/tanks/Tanks.java index 13b4ba1..9faa05e 100644 --- a/src/tanks/Tanks.java +++ b/src/tanks/Tanks.java @@ -43,6 +43,7 @@ public class Tanks frame=new JFrame("Tanks project"); frame.setSize(fwidth,fheight + 150); + frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); newGame(); @@ -184,7 +185,7 @@ public class Tanks private class Player extends Living { private Turret t; - private boolean up,down,left,right; + private boolean up,down,left,right, rleft, rRight; public Player() { @@ -201,12 +202,19 @@ public class Tanks void move() { + if(rleft) + { + t.rotate(-1); + } + if(rRight) + { + t.rotate(1); + } if(up==true) { super.move(-1); t.move(-1); - } if(down==true) { @@ -239,8 +247,8 @@ public class Tanks { y-=speed; } - t.x = x+12; - t.y = y+12; + t.x = x; + t.y = y; } void updateDir(KeyEvent e, boolean pressed) @@ -264,11 +272,11 @@ public class Tanks } else if(id==KeyEvent.VK_A) { - t.rotate(-1); + rleft = pressed; } else if(id==KeyEvent.VK_D) { - t.rotate(1); + rRight = pressed; } else if(id==KeyEvent.VK_SPACE) { @@ -352,8 +360,8 @@ public class Tanks { width = 25; height = 25; - x = e.x; - y = e.y; + x = e.x + 12; + y = e.y + 12; direction = e.direction; speed = 10; imageLocation = "bullet.png"; @@ -423,13 +431,13 @@ public class Tanks { public Turret(RotationalElement e) { - width = 25; - height = 25; + width = 50; + height = 50; x = e.x; y = e.y; direction = e.direction; speed = 10; - imageLocation = "bullet.png"; + imageLocation = "turret.png"; super.loadImage(); } public void shoot() @@ -562,7 +570,7 @@ public class Tanks Enemy temp = new Zombie(); temp.spawn(frame); enemy.add(temp); - + } diff --git a/src/tanks/enemyTank.png b/src/tanks/enemyTank.png new file mode 100644 index 0000000..29132b6 Binary files /dev/null and b/src/tanks/enemyTank.png differ diff --git a/src/tanks/player.png b/src/tanks/player.png index 20f9702..6331425 100644 Binary files a/src/tanks/player.png and b/src/tanks/player.png differ diff --git a/src/tanks/turret.png b/src/tanks/turret.png new file mode 100644 index 0000000..a90d99f Binary files /dev/null and b/src/tanks/turret.png differ