Commit ace3f3b2 authored by nargessalehi98's avatar nargessalehi98

Add arrayList of tanks .

parent eae747f7
...@@ -64,6 +64,7 @@ public class GameFrame extends JFrame { ...@@ -64,6 +64,7 @@ public class GameFrame extends JFrame {
private BufferStrategy bufferStrategy; private BufferStrategy bufferStrategy;
private ArrayList<Wall> walls; private ArrayList<Wall> walls;
private ArrayList<Prize> prizes; private ArrayList<Prize> prizes;
private ArrayList<Tank> tanks;
private boolean allWallsAdded = false; private boolean allWallsAdded = false;
public GameFrame(String title) throws AWTException, IOException { public GameFrame(String title) throws AWTException, IOException {
...@@ -81,6 +82,8 @@ public class GameFrame extends JFrame { ...@@ -81,6 +82,8 @@ public class GameFrame extends JFrame {
prizes=new ArrayList<>(); prizes=new ArrayList<>();
Controller.prizes=prizes; Controller.prizes=prizes;
Controller.getPrize=getPrize; Controller.getPrize=getPrize;
tanks=new ArrayList<>();
Controller.tanks=tanks;
try { try {
...@@ -221,6 +224,7 @@ public class GameFrame extends JFrame { ...@@ -221,6 +224,7 @@ public class GameFrame extends JFrame {
g2d.drawImage(image2, 150, 750, null); g2d.drawImage(image2, 150, 750, null);
player1 = "narges"; player1 = "narges";
g2d.drawString(player1, 160, 745); g2d.drawString(player1, 160, 745);
g2d.drawString(String.valueOf(tanks.get(0).getHealth()),160,850);
} }
// if (player2 != null) { // if (player2 != null) {
// g2d.drawImage(image3, 450, 750, null); // g2d.drawImage(image3, 450, 750, null);
...@@ -240,6 +244,7 @@ public class GameFrame extends JFrame { ...@@ -240,6 +244,7 @@ public class GameFrame extends JFrame {
if (numOfPlayer > 0) { if (numOfPlayer > 0) {
Tank tank = new Tank("tank_blue_RS.png"); Tank tank = new Tank("tank_blue_RS.png");
taken = tank.getIcon(); taken = tank.getIcon();
tanks.add(tank);
g2d.drawImage(rotate(tank.getIcon(), state.rotateAmount), state.locX, state.locY, null); g2d.drawImage(rotate(tank.getIcon(), state.rotateAmount), state.locX, state.locY, null);
// numOfPlayer--; // numOfPlayer--;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment