Fix wave notification text
This commit is contained in:
@@ -616,7 +616,10 @@ static void renderGame(Game *game, float dt) {
|
|||||||
static f32 waveDisplay = 0.0f;
|
static f32 waveDisplay = 0.0f;
|
||||||
if (isWaveOver(&game->waveInfo)) {
|
if (isWaveOver(&game->waveInfo)) {
|
||||||
game->waveInfo = getWaveInfo(&game->waves, game->waveInfo.number + 1);
|
game->waveInfo = getWaveInfo(&game->waves, game->waveInfo.number + 1);
|
||||||
waveDisplay = 1.6f;
|
}
|
||||||
|
if (game->waveInfo.number > 0 && game->waveInfo.started &&
|
||||||
|
game->waveInfo.elapsed - game->waveInfo.data.timeBeforeStart < 1.0f) {
|
||||||
|
waveDisplay = 0.6f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waveDisplay > 0.0f) {
|
if (waveDisplay > 0.0f) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void drawGameUI(Game *game, f32 dt) {
|
|||||||
i32 min = startingIn / 60.0f;
|
i32 min = startingIn / 60.0f;
|
||||||
i32 sec = startingIn - (min * 60);
|
i32 sec = startingIn - (min * 60);
|
||||||
snprintf(waveDisplay, sizeof(waveDisplay), "Wave %d starting in: %02d:%02d ",
|
snprintf(waveDisplay, sizeof(waveDisplay), "Wave %d starting in: %02d:%02d ",
|
||||||
game->waveInfo.number + 1, min, sec);
|
game->waveInfo.number, min, sec);
|
||||||
}
|
}
|
||||||
uiBaseLabel(waveDisplay, game->font, 0.5f, WHITE);
|
uiBaseLabel(waveDisplay, game->font, 0.5f, WHITE);
|
||||||
bzUIPopParent(UI); // topBarRight
|
bzUIPopParent(UI); // topBarRight
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
#include "entity_factory.h"
|
#include "entity_factory.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define NUM_WAVES 14
|
#define NUM_WAVES 15
|
||||||
|
|
||||||
EnemyWaves getDefaultWaves() {
|
EnemyWaves getDefaultWaves() {
|
||||||
static WaveData waves[NUM_WAVES] = {
|
static WaveData waves[NUM_WAVES] = {
|
||||||
{ 0, 0.0f, 5, 1.0f, 0, 8 * 60 },
|
{ 0, 0.0f, 0, 0.0f, 0, 0}, // Dummy wave
|
||||||
|
{ 0, 0.0f, 5, 1.0f, 0, 8 * 60},
|
||||||
{ 0, 0.0f, 20, 2.0f, 0, 3 * 60 },
|
{ 0, 0.0f, 20, 2.0f, 0, 3 * 60 },
|
||||||
{ 5, 0.2f, 30, 2.2f, 0, 60 },
|
{ 5, 0.2f, 30, 2.2f, 0, 60 },
|
||||||
{ 10, 0.5f, 40, 2.4f, 0, 40 },
|
{ 10, 0.5f, 40, 2.4f, 0, 40 },
|
||||||
@@ -75,7 +76,7 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) {
|
|||||||
wave->goblinsElapsed += dt;
|
wave->goblinsElapsed += dt;
|
||||||
|
|
||||||
f32 timeForGoblin = 1.0f / wave->data.goblinSendRate;
|
f32 timeForGoblin = 1.0f / wave->data.goblinSendRate;
|
||||||
while (wave->goblinsElapsed >= timeForGoblin) {
|
while (wave->goblinsToSend > 0 && wave->goblinsElapsed >= timeForGoblin) {
|
||||||
Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20);
|
Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20);
|
||||||
entityCreate(ENTITY_GOBLIN, spawnPos, PLAYER_ENEMY, game);
|
entityCreate(ENTITY_GOBLIN, spawnPos, PLAYER_ENEMY, game);
|
||||||
wave->goblinsElapsed -= timeForGoblin;
|
wave->goblinsElapsed -= timeForGoblin;
|
||||||
@@ -83,7 +84,7 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f32 timeForOrc = 1.0f / wave->data.orcSendRate;
|
f32 timeForOrc = 1.0f / wave->data.orcSendRate;
|
||||||
while (wave->orcsElapsed >= timeForOrc) {
|
while (wave->orcsToSend > 0 && wave->orcsElapsed >= timeForOrc) {
|
||||||
Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20);
|
Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20);
|
||||||
entityCreate(ENTITY_ORC, spawnPos, PLAYER_ENEMY, game);
|
entityCreate(ENTITY_ORC, spawnPos, PLAYER_ENEMY, game);
|
||||||
wave->orcsElapsed -= timeForOrc;
|
wave->orcsElapsed -= timeForOrc;
|
||||||
|
|||||||
Reference in New Issue
Block a user