forked from GiorgiaC9/hci-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.pde
65 lines (48 loc) · 1.17 KB
/
store.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
ControlP5 CP6;
void storeSetup(){
CP6 = new ControlP5(this);
pfont = createFont("Arial", 10, true);
font = new ControlFont(pfont, 10);
CP6.addButton("gravity")
.setLabel("gravity")
.setFont(font)
.setPosition(width/2-50, height/2-120)
.setSize(100, 50)
;
textSize(70);
CP6.addButton("back")
.setLabel("back")
.setFont(font)
.setPosition(width/2-50, height/2-60)
.setSize(100, 50)
;
textSize(70);
CP6.addButton("fakeButton")
.setSize(0,0)
.setLabel("");
textAlign(CENTER, CENTER);
}
public void gravity() {
money+=1;
}
public void back() {
CP6.getController("gravity").remove(); // removes the button
CP6.getController("back").remove(); // removes the button
startScreenSetup();
}
void readMoney(){
BufferedReader reader = createReader("data.txt");
try {
money = int(reader.readLine());
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
void updateMoney(){
PrintWriter output = createWriter("data.txt");
money+=score;
output.println(money);
output.flush(); // Writes the remaining data to the file
output.close(); // Finishes the file
}