-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunner.pde
103 lines (66 loc) · 1.4 KB
/
Runner.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
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
class Brick{
PVector pos2;
float r = 0;
Block b1;
Block b2;
Block b3;
Block b4;
Brick(){
pos2 = new PVector(300, 40);
b1 = new Block(pos2.x + 20, pos2.y );
b2 = new Block(pos2.x , pos2.y);
b3 = new Block(pos2.x , pos2.y - 20);
b4 = new Block(pos2.x - 20, pos2.y );
}
void show(){
pushMatrix();
translate(width/2+(b3.area.x/2), height/2 +(b3.area.y/2));
rotate(r);
translate(-width/2+(b3.area.x/2), -height/2 +(b3.area.y/2));
b1.display();
b2.display();
b3.display();
b4.display();
popMatrix();
}
void motion(){
if(b1.pos.y != height-20)
{
b1.move();
b2.move();
b3.move();
b4.move();
}
if( b1.pos.x == b1.rightE)
{
b2.rmotion = 0;
b3.rmotion = 0;
b4.rmotion = 0;
}else if(b1.pos.x != b1.rightE)
{
b2.rmotion = 20;
b3.rmotion = 20;
b4.rmotion = 20;
}
if( b4.pos.x == b4.leftE)
{
b2.lmotion = 0;
b3.lmotion = 0;
b1.lmotion = 0;
}else if(b1.pos.x != b1.leftE)
{
b2.lmotion = 20;
b3.lmotion = 20;
b1.lmotion = 20;
}
}
void rotation(){
if(keyPressed)
{
if(key == 'f')
{
r += (PI/4);
}
}
}
}