Added auto-shoot!
This commit is contained in:
parent
9d662a1509
commit
22c3c33305
1 changed files with 11 additions and 2 deletions
11
main.c
11
main.c
|
|
@ -41,6 +41,7 @@ int main() {
|
|||
int pause = 0;
|
||||
int max_height;
|
||||
int max_width;
|
||||
int auto_shoot = 0;
|
||||
|
||||
// Giocatore
|
||||
struct game_obj player = {};
|
||||
|
|
@ -124,7 +125,7 @@ int main() {
|
|||
player.x += 2;
|
||||
} else if (input == KEY_LEFT && !pause && player.x > 2) {
|
||||
player.x -= 2;
|
||||
} else if (input == ' ' && bullet_attivi < BULLET_N && !pause) {
|
||||
} else if (!auto_shoot && input == ' ' && bullet_attivi < BULLET_N && !pause) {
|
||||
bullet[next_bullet].x = player.x;
|
||||
bullet[next_bullet].y = player.y - 1;
|
||||
bullet[next_bullet].active = 1;
|
||||
|
|
@ -132,6 +133,14 @@ int main() {
|
|||
pause = !pause;
|
||||
} else if (input == 'q') {
|
||||
player.active = 0;
|
||||
} else if (input == 'g') {
|
||||
auto_shoot= !auto_shoot;
|
||||
}
|
||||
|
||||
if (auto_shoot && bullet_attivi < BULLET_N && !pause) {
|
||||
bullet[next_bullet].x = player.x;
|
||||
bullet[next_bullet].y = player.y - 1;
|
||||
bullet[next_bullet].active = 1;
|
||||
}
|
||||
|
||||
// Aggiorna proiettile
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue