added wall defense mechanic
This commit is contained in:
parent
ce2b4dbb6e
commit
5eab405baf
2 changed files with 8 additions and 8 deletions
|
@ -129,7 +129,7 @@ void InitGameplayScreen(void)
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LEVEL1: fireworks[i].speed.x = GetRandomValue(100, 200); break;
|
case LEVEL1: fireworks[i].speed.x = GetRandomValue(100, 200); break;
|
||||||
case LEVEL2: fireworks[i].speed.x = GetRandomValue(200, 300); 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;
|
fireworks[i].color = RAYWHITE;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ void InitGameplayScreen(void)
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LEVEL1: fireworkAmount = 100; break;
|
case LEVEL1: fireworkAmount = 100; break;
|
||||||
case LEVEL2: fireworkAmount = 150; break;
|
case LEVEL2: fireworkAmount = 150; break;
|
||||||
case LEVEL3: fireworkAmount = 200; break;
|
case LEVEL3: fireworkAmount = 100; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pause = 0;
|
pause = 0;
|
||||||
|
@ -245,8 +245,7 @@ void UpdateGameplayScreen(void)
|
||||||
if (IsKeyPressed(KEY_NINE)) ammo = 99;
|
if (IsKeyPressed(KEY_NINE)) ammo = 99;
|
||||||
if (IsKeyPressed(KEY_ZERO)) ammo = 0;
|
if (IsKeyPressed(KEY_ZERO)) ammo = 0;
|
||||||
if (IsKeyPressed(KEY_G)) finishfromGameplayScreen = 1;
|
if (IsKeyPressed(KEY_G)) finishfromGameplayScreen = 1;
|
||||||
if (IsKeyPressed(KEY_R)) finishfromGameplayScreen = 2;
|
if (IsKeyPressed(KEY_Q)) finishfromGameplayScreen = 4;
|
||||||
if (IsKeyPressed(KEY_W)) finishfromGameplayScreen = 3;
|
|
||||||
if (IsKeyPressed(KEY_EQUAL)) level++;
|
if (IsKeyPressed(KEY_EQUAL)) level++;
|
||||||
if (IsKeyPressed(KEY_MINUS)) level--;
|
if (IsKeyPressed(KEY_MINUS)) level--;
|
||||||
|
|
||||||
|
@ -311,7 +310,6 @@ void UpdateGameplayScreen(void)
|
||||||
for (int j = 0; j < MAX_SHOOTS; j++) {
|
for (int j = 0; j < MAX_SHOOTS; j++) {
|
||||||
if (CheckCollisionRecs(shoot[j].hitbox, fireworks[i].hitbox) && shoot[j].active) {
|
if (CheckCollisionRecs(shoot[j].hitbox, fireworks[i].hitbox) && shoot[j].active) {
|
||||||
// if (!mute) PlaySoundMulti(enemy.fxhit);
|
// if (!mute) PlaySoundMulti(enemy.fxhit);
|
||||||
if (!mute) PlaySoundMulti(fxboom);
|
|
||||||
fireworks[i].color = BLACK;
|
fireworks[i].color = BLACK;
|
||||||
shoot[j].active = 0;
|
shoot[j].active = 0;
|
||||||
fireworks[i].hp--;
|
fireworks[i].hp--;
|
||||||
|
@ -333,13 +331,13 @@ void UpdateGameplayScreen(void)
|
||||||
} */
|
} */
|
||||||
break;
|
break;
|
||||||
case 1:
|
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;
|
// trigMov = sin(2*PI/20*fireworks[i].hitbox.x) * 200;
|
||||||
fireworks[i].hitbox.x -= fireworks[i].speed.x * GetFrameTime();
|
fireworks[i].hitbox.x -= fireworks[i].speed.x * GetFrameTime();
|
||||||
// fireworks[i].hitbox.y += trigMov*GetFrameTime();
|
// fireworks[i].hitbox.y += trigMov*GetFrameTime();
|
||||||
// Firework wall collision
|
// Firework wall collision
|
||||||
if (((fireworks[i].hitbox.x + -firework_sprite.width) > GetScreenWidth()
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,9 @@ void DrawTitleScreen(void)
|
||||||
DrawText("Press 'Left-ALT' + 'F' for full screen", 5, 100, 10, WHITE);
|
DrawText("Press 'Left-ALT' + 'F' for full screen", 5, 100, 10, WHITE);
|
||||||
DrawText("Press 'R' to restart", 5, 120, 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 '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);
|
// DrawText("Ver: 0.1", 680, 420, 30, WHITE);
|
||||||
if (titleSelected == 0) DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, WHITE);
|
if (titleSelected == 0) DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, WHITE);
|
||||||
else DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, BLUE);
|
else DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, BLUE);
|
||||||
|
|
Loading…
Reference in a new issue