-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pistol.java
42 lines (37 loc) · 933 Bytes
/
Pistol.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* Pistol class. Pistol is a tower. It costs 100, can attack 1 enemy at a time
* and has a diameter of 50 px
*
* @author haolidu
* @version 1.00
*/
public class Pistol extends Tower {
/**
* Constructor for slingshot.
*
* @param x
* @param y
* @throws IOException
*/
public Pistol(int x, int y) throws IOException {
super(x, y);
setAttackRadius(100);
setAttackPower(2);
icon = ImageIO.read(getClass().getResource("pistol.png"));
circle = new Circle(x - getAttackRadius() / 2, y - getAttackRadius()
/ 2, getAttackRadius());
simulAttack = 1;
cost = 100;
}
/**
* Gets the String representation of the tower.
*
* @return String of the tower
*/
@Override
public String toString() {
return "Pistol Tower";
}
}