From 22c3c33305be5002f956906122736bfca6d9bde8 Mon Sep 17 00:00:00 2001 From: AlbYoda Date: Fri, 7 Nov 2025 13:37:00 +0100 Subject: [PATCH] Added auto-shoot! --- main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e24fd47..863c258 100644 --- a/main.c +++ b/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 @@ -238,4 +247,4 @@ int main() { endwin(); printf("Gioco terminato.\n"); return 0; -} \ No newline at end of file +}