-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gui.pde
54 lines (48 loc) · 981 Bytes
/
Gui.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
/**
* The coins panel at the top right of the screen.
*
*/
class Gui extends Menu{
PImage scoreImage;
/**
* Updates the GUI
*/
Gui() {
super();
scoreImage = loadImage("Sprits/ScoreGUI.png");
}
/**
* Updates the GUI
*/
@Override
void update() {
smoothMove(0.25);
for (int c = 0; c < updatePhysics; c++) {
simplePhysicsCal();
}
offLoc = new PVector(0,-scoreImage.height*1.01);
if (on) {
des = onLoc;
}
else {
des = offLoc;
}
}
/**
* Renders the GUI
*/
@Override
void render() {
if (loc.y >= -scoreImage.height) {
pushMatrix();
translate(loc.x+width-scoreImage.width/2,loc.y+scoreImage.height/2);
tint(red(dynamicColor), green(dynamicColor), blue(dynamicColor),255*0.875);
image(scoreImage,0,0);
fill(dynamicColor);
textSize(32);
textAlign(CENTER,CENTER);
text("Coins:"+nf(world.score,5), 10, 0);
popMatrix();
}
}
}