-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJumpy.pde
More file actions
104 lines (98 loc) · 1.97 KB
/
Copy pathJumpy.pde
File metadata and controls
104 lines (98 loc) · 1.97 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
int punktzahl = 0;
int bgt = 12;
boolean stop = false;
OBSTACLE o = new OBSTACLE();
PLAYER p = new PLAYER();
boolean pause = false;
int framerate = 60;
STAR[] stars = new STAR[300];
void setup() {
size(500, 800);
frameRate(framerate);
for(int i = 0; i< stars.length; i++){
stars [i] = new STAR();
}
}
void draw() {
if (!p.alive)background(51);
//hit
if (!pause && p.alive) {
background(51);
if(bgt<=10){
fill(255,0,0,100);
rect(0,0,width,height);
bgt++;
}
for(STAR s: stars){
s.update();
}
fill(255, 0, 100);
p.update();
o.update();
fill(0, 0, 255);
textSize(50);
text(p.jumps, width-60, 60);
fill(255, 0, 0);
text(p.leben, 10, 60);
fill(0,255, 0);
text(p.points, width/2 -25, 60);
text("x"+p.streak, width-60, height/2);
}
if (!p.alive) {
fill(0,255, 0);
text(p.points, width/2 -25, 60);
text("x"+p.streak, width-60, height/2);
fill(255,0,0,100);
rect(0,0,width,height);
fill(255, 100, 0);
textSize(100);
text("DEAD!", width/2-175, height/2 -50);
textSize(50);
text(" press'r' to restart!",width/2-225,height/2 +50);
}
}
void reset() {
p.points = 0;
p.streak = 0;
o.v = 0;
o.oReset();
p.pos.y = 100;
p.leben = 3;
p.jumps= 5;
p.alive = true;
}
void keyPressed() {
//pause
if (key == 'p' && !pause) pause = true;
else if (key == 'p' && pause) pause = false;
//resetw
if (key == 'r' && !p.alive) {
reset();
}
// Jump
if (key == '+') p.jumps++;
if (key == 'w' && p.jumps > 0) {
p.fv = -2;
o.jump();
p.jumps--;
if(p.streak >= 2) p.streak-=2;
}
//neuStart
if (key == 'g' && !stop) {
}
// links / rechts
if ( key == 'a') {
p.left = true;
}
if ( key == 'd') {
p.right = true;
}
}
void keyReleased() {
if ( key == 'a') {
p.left = false;
}
if ( key == 'd') {
p.right = false;
}
}