-
Notifications
You must be signed in to change notification settings - Fork 1
/
controles.pde
59 lines (52 loc) · 1004 Bytes
/
controles.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
void keyPressed(){
switch( key ){
case 'w':
p1c[0] = true;
break;
case 's':
p1c[1] = true;
break;
case 'a':
p1c[2] = true;
break;
case 'd':
p1c[3] = true;
break;
case 'c':
p1c[4] = true;
break;
case '.':
p2c[4] = true;
break;
}
if (keyCode == UP) p2c[0] = true;
if (keyCode == DOWN) p2c[1] = true;
if (keyCode == LEFT) p2c[2] = true;
if (keyCode == RIGHT) p2c[3] = true;
}
void keyReleased(){
switch( key ){
case 'w':
p1c[0] = false;
break;
case 's':
p1c[1] = false;
break;
case 'a':
p1c[2] = false;
break;
case 'd':
p1c[3] = false;
break;
case 'c':
p1c[4] = false;
break;
case '.':
p2c[4] = false;
break;
}
if (keyCode == UP) p2c[0] = false;
if (keyCode == DOWN) p2c[1] = false;
if (keyCode == LEFT) p2c[2] = false;
if (keyCode == RIGHT) p2c[3] = false;
}