-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.pde
More file actions
40 lines (36 loc) · 736 Bytes
/
game.pde
File metadata and controls
40 lines (36 loc) · 736 Bytes
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
PFont font;
int score;
int time;
Player player;
void setup() {
size(600, 600);
background(255);
font = createFont("font/8bit_wonder/8-BIT WONDER.TTF", 16);
textFont(font);
score = 0;
time = millis();
player = new Player(width / 2, height / 2, 10, 4);
}
void draw() {
background(255);
fill(0);
if (millis() > time + 1000) {
score += 1;
time = millis();
print(time);
}
String merp = "Current time alive: " + score;
text(merp, 0, 50);
player.move();
player.display();
}
void keyPressed() {
//if (key == 'a') {
// player.move('a');
//}
player.setMove(keyCode, true);
}
void keyReleased() {
if (keyCode != 'W')
player.setMove(keyCode, false);
}