Commit a737b010 authored by nargessalehi98's avatar nargessalehi98

Add alive field.

parent 3c1f24f1
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -10,28 +9,24 @@ public class Tank { ...@@ -10,28 +9,24 @@ public class Tank {
int y; int y;
double rotateAmount; double rotateAmount;
BufferedImage icon; BufferedImage icon;
Bullets bullets; Bullet bullet;
GameState state; GameState state;
boolean alive;
String prize; String prize;
int Health; int Health;
public String getPrize() { public Tank(String path, int x, int y, double rotateAmount) {
return prize;
}
public void setPrize(String prize) {
this.prize = prize;
}
public Tank(String path) {
Health = 100; Health = 100;
try { try {
icon = ImageIO.read(new File(path)); icon = ImageIO.read(new File(path));
} catch (IOException e) { } catch (IOException e) {
System.out.println("File not found "); System.out.println("File not found ");
} }
alive = true;
this.x = x;
this.y = y;
this.rotateAmount = rotateAmount;
bullets = new Bullets();
} }
public BufferedImage getIcon() { public BufferedImage getIcon() {
...@@ -50,14 +45,6 @@ public class Tank { ...@@ -50,14 +45,6 @@ public class Tank {
return state; return state;
} }
public double getRotateAmount() {
return rotateAmount;
}
public Bullets getBullets() {
return bullets;
}
public int getHealth() { public int getHealth() {
return Health; return Health;
} }
...@@ -65,4 +52,12 @@ public class Tank { ...@@ -65,4 +52,12 @@ public class Tank {
public void setHealth(int healthDamage) { public void setHealth(int healthDamage) {
Health = Health - healthDamage; Health = Health - healthDamage;
} }
}
public String getPrize() {
return prize;
}
public void setPrize(String prize) {
this.prize = prize;
}
}
\ No newline at end of file
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