From 5eab405bafd85c6ee17854f193f8eb3d16b04dde Mon Sep 17 00:00:00 2001 From: Mark B Date: Mon, 21 Nov 2022 19:07:06 -0500 Subject: [PATCH] added wall defense mechanic --- src/Gameplay.c | 12 +++++------- src/Title.c | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Gameplay.c b/src/Gameplay.c index a2d9d78..9f2a52a 100644 --- a/src/Gameplay.c +++ b/src/Gameplay.c @@ -129,7 +129,7 @@ void InitGameplayScreen(void) switch (level) { case LEVEL1: fireworks[i].speed.x = GetRandomValue(100, 200); break; case LEVEL2: fireworks[i].speed.x = GetRandomValue(200, 300); break; - case LEVEL3: fireworks[i].speed.x = GetRandomValue(300, 400); break; + case LEVEL3: fireworks[i].speed.x = GetRandomValue(250, 350); break; } fireworks[i].color = RAYWHITE; } @@ -149,7 +149,7 @@ void InitGameplayScreen(void) switch (level) { case LEVEL1: fireworkAmount = 100; break; case LEVEL2: fireworkAmount = 150; break; - case LEVEL3: fireworkAmount = 200; break; + case LEVEL3: fireworkAmount = 100; break; } pause = 0; @@ -245,8 +245,7 @@ void UpdateGameplayScreen(void) if (IsKeyPressed(KEY_NINE)) ammo = 99; if (IsKeyPressed(KEY_ZERO)) ammo = 0; if (IsKeyPressed(KEY_G)) finishfromGameplayScreen = 1; - if (IsKeyPressed(KEY_R)) finishfromGameplayScreen = 2; - if (IsKeyPressed(KEY_W)) finishfromGameplayScreen = 3; + if (IsKeyPressed(KEY_Q)) finishfromGameplayScreen = 4; if (IsKeyPressed(KEY_EQUAL)) level++; if (IsKeyPressed(KEY_MINUS)) level--; @@ -311,7 +310,6 @@ void UpdateGameplayScreen(void) for (int j = 0; j < MAX_SHOOTS; j++) { if (CheckCollisionRecs(shoot[j].hitbox, fireworks[i].hitbox) && shoot[j].active) { // if (!mute) PlaySoundMulti(enemy.fxhit); - if (!mute) PlaySoundMulti(fxboom); fireworks[i].color = BLACK; shoot[j].active = 0; fireworks[i].hp--; @@ -333,13 +331,13 @@ void UpdateGameplayScreen(void) } */ break; case 1: - if (fireworks[i].hp < 1) { fireworkAmount--; fireworks[i].active = 0; } + if (fireworks[i].hp < 1) { fireworkAmount--; fireworks[i].active = 0; if (!mute) PlaySoundMulti(fxboom); } // trigMov = sin(2*PI/20*fireworks[i].hitbox.x) * 200; fireworks[i].hitbox.x -= fireworks[i].speed.x * GetFrameTime(); // fireworks[i].hitbox.y += trigMov*GetFrameTime(); // Firework wall collision if (((fireworks[i].hitbox.x + -firework_sprite.width) > GetScreenWidth() - || (fireworks[i].hitbox.x <= -firework_sprite.width))) fireworks[i].active = 0; + || (fireworks[i].hitbox.x <= -firework_sprite.width))) { fireworks[i].active = 0; player.hp--; fireworkAmount--; } break; } } diff --git a/src/Title.c b/src/Title.c index 4004545..f4b78fd 100644 --- a/src/Title.c +++ b/src/Title.c @@ -49,7 +49,9 @@ void DrawTitleScreen(void) DrawText("Press 'Left-ALT' + 'F' for full screen", 5, 100, 10, WHITE); DrawText("Press 'R' to restart", 5, 120, 10, WHITE); DrawText("Press 'ENTER' or 'START' to select an option", 5, 140, 10, WHITE); - DrawText("Press 'X' or 'A' on a gamepad to shoot", 5, 160, 10, WHITE); + DrawText("Press 'Z' or 'A' on a gamepad to shoot", 5, 160, 10, WHITE); + DrawText("Press 'Q' to return to level select", 5, 180, 10, WHITE); + DrawText("Remember to shoot down the fireworks.", 5, 200, 10, RED); // DrawText("Ver: 0.1", 680, 420, 30, WHITE); if (titleSelected == 0) DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, WHITE); else DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, BLUE);