-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebuffButton.java
More file actions
110 lines (99 loc) · 2.82 KB
/
DebuffButton.java
File metadata and controls
110 lines (99 loc) · 2.82 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* The button to buy debuffs on towers <br>
* Debuffs are slows, stuns, -armor, etc
*
* @author James Lu
* @version 1.0
*/
public class DebuffButton extends UIButton
{
private boolean bought;
private boolean dummy;
private int id;
private int level;
private int cost;
private String name;
public DebuffButton (int id){
if (id == 0){ //stun
bg[0] = new GreenfootImage ("Debuff/stunned.png");
bg[1] = new GreenfootImage ("Debuff/stunned.png");
bg[2] = new GreenfootImage ("Debuff/stunned.png");
name = "Stun";
}else if (id == 1){ //lightning
bg[0] = new GreenfootImage ("Debuff/lightning.png");
bg[1] = new GreenfootImage ("Debuff/lightning.png");
bg[2] = new GreenfootImage ("Debuff/lightning.png");
name = "Lightning";
}else if (id == 2){ //water
bg[0] = new GreenfootImage ("Debuff/freeze.png");
bg[1] = new GreenfootImage ("Debuff/freeze.png");
bg[2] = new GreenfootImage ("Debuff/freeze.png");
name = "Freeze";
}else if (id == 3){ //fire
bg[0] = new GreenfootImage ("Debuff/burning.png");
bg[1] = new GreenfootImage ("Debuff/burning.png");
bg[2] = new GreenfootImage ("Debuff/burning.png");
name = "Burn";
}else{ //earth
bg[0] = new GreenfootImage ("Debuff/stone.png");
bg[1] = new GreenfootImage ("Debuff/stone.png");
bg[2] = new GreenfootImage ("Debuff/stone.png");
name = "Earth";
}
bg[0].setTransparency (100);
bg[1].setTransparency (200);
bought = false;
this.id = id;
level = 1;
cost = 50;
}
public void act(){
super.act();
if (bought){
setImage (bg[2]);
}
}
/**
* changes the button to see if its bought
*/
public void bought (boolean t){
bought = t;
}
/**
* returns true if the debuff is already bought
*/
public boolean isBought(){
return bought;
}
/**
* returns the id of the debuff
*/
public int getId (){
return id;
}
/**
* returns the level of this debuff
*/
public int getLevel(){
return level;
}
/**
* returns the name of the debuff
*/
public String getName(){
return name;
}
/**
* returns if this button is a dummy button or not
*/
public boolean isDummy(){
return dummy;
}
/**
* returns the cost of the button
*/
public int getCost(){
return cost;
}
}