-
Notifications
You must be signed in to change notification settings - Fork 1
/
Towers.hx
47 lines (43 loc) · 1.06 KB
/
Towers.hx
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
43
44
45
46
47
import Math;
class TowerType {
public var id:Int;
public var base_range:Int;
public var base_dmg:Int;
public var base_cost:Int;
public var color:Int;
public var base_rate:Int; // time between shots in frames
public var name:String;
public var hotkey:String;
public function new(id=1,range=50,dmg=15,rate=20,cost=5,col=0x0000aa,n="[Tower]",hkey="none") {
this.id= id;
base_range= range;
base_dmg= dmg;
base_rate= rate;
base_cost= cost;
color= col;
name= n;
hotkey= hkey;
}
public function dmg(l=0) {
return base_dmg*(l+1);
}
public function range(l=0) {
return base_range + 4*l;
}
public function rate(l=0) {
return base_rate;
}
public function cost(l=0) {
return Std.int( base_cost * Math.pow(2,l) );
}
}
class BasicTower extends TowerType {
public function new() {
super(1,50,15,20,5,0x0000a0,"Basic Tower","1");
}
}
class LongRangeTower extends TowerType {
public function new() {
super(2,80,10,20,10,0x00a0a0,"Long Range","2");
}
}