-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPowerUp.pde
67 lines (59 loc) · 1.38 KB
/
PowerUp.pde
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
class PowerUp extends GameObject
{
PShape shape;
float price;
char buyKey;
boolean bought;
String name;
PowerUp(float price, char buyKey, color boxColour, color panelColour, String name)
{
this.price = price;
this.buyKey = buyKey;
this.bought = false;
this.name = name;
create(boxColour, panelColour);
}
void create(color boxColour, color panelColour)
{
shape = createShape(GROUP);
strokeWeight(2);
//Creating the perk shape
fill(boxColour);
PShape box = createShape(RECT, 0, 0, 150, 35, 2);
fill(panelColour);
if(name == "Double Tap")
{
PShape frontLeft = createShape(RECT, 5, -10, 67.5, 10);
PShape frontRight = createShape(RECT, 77.5, -10, 67.5, 10);
shape.addChild(frontLeft);
shape.addChild(frontRight);
}
else
{
PShape frontLeft = createShape(RECT, 5, 35, 67.5, 10);
PShape frontRight = createShape(RECT, 77.5, 35, 67.5, 10);
shape.addChild(frontLeft);
shape.addChild(frontRight);
}
shape.addChild(box);
}
void render(String name, float posx, float posy)
{
shape(shape, posx, posy);
//Speed Cola
fill(255);
textFont(perkFont);
if(this.name == "Double Tap")
{
textSize(15);
}
else {
textSize(30);
}
text(name, posx+20, posy+25);
textFont(zombieFont);
}
void update()
{
}
}