-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrols.c
63 lines (55 loc) · 1.41 KB
/
controls.c
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
BOOLEAN Walking = 0;
uint8_t playerDir = backward;
uint8_t enemyDir = backward;
void HandleControls(int input) {
*(unsigned char*)(IO) = requestData; //request input data
if(running){
switch (input)
{
case J_UP:
playerDir = forward;
playerY -= playerSpeed;
Walking = 1;
break;
case J_DOWN:
playerDir = backward;
playerY += playerSpeed;
Walking = 1;
break;
case J_LEFT:
playerDir = left;
playerX -= playerSpeed;
Walking = 1;
break;
case J_RIGHT:
playerDir = right;
playerX += playerSpeed;
Walking = 1;
break;
case J_A:
playerAttack();
break;
case J_B:
break;
case J_SELECT:
break;
case J_START:
break;
default:
Walking = 0;
break;
}
return;
}
else if(input == J_START) {
printfTileMap(" ");
running = 1;
playerY = 60;
playerX = 60;
enemyX = 20;
enemyY = 20;
playerHealth = 10;
playerDead = 0;
return;
}
}