diff --git a/build_web.sh b/build_web.sh index 660084c..bbe5d0b 100755 --- a/build_web.sh +++ b/build_web.sh @@ -4,7 +4,7 @@ mkdir build_web pushd build_web || exit -emcmake cmake .. -DPLATFORM=Web +emcmake cmake -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release .. emmake make mv PixelDefense.html index.html diff --git a/game/wave.c b/game/wave.c index 32b9a43..ee7071f 100644 --- a/game/wave.c +++ b/game/wave.c @@ -44,7 +44,7 @@ WaveInfo getWaveInfo(const EnemyWaves *waves, i32 idx) { WaveData waveData; if (idx >= waves->numWaves) { waveData = waves->waves[waves->numWaves - 1]; - waveData.difficultyScale += (idx - waves->numWaves) * 0.1f; + waveData.difficultyScale += (idx - waves->numWaves) * 0.25f; } else { waveData = waves->waves[idx]; @@ -78,7 +78,12 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) { f32 timeForGoblin = 1.0f / wave->data.goblinSendRate; while (wave->goblinsToSend > 0 && wave->goblinsElapsed >= timeForGoblin) { Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20); - entityCreate(ENTITY_GOBLIN, spawnPos, PLAYER_ENEMY, game); + ecs_entity_t e = entityCreate(ENTITY_GOBLIN, spawnPos, PLAYER_ENEMY, game); + ecs_set(ECS, e, Health, { + .startHP = 40.0f * (1 + wave->data.difficultyScale), + .hp = 40.0f * (1 + wave->data.difficultyScale), + .lastChanged = -1000.0f, + }); wave->goblinsElapsed -= timeForGoblin; wave->goblinsToSend--; } @@ -86,7 +91,12 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) { f32 timeForOrc = 1.0f / wave->data.orcSendRate; while (wave->orcsToSend > 0 && wave->orcsElapsed >= timeForOrc) { Vector2 spawnPos = randomizeSpawnPos(game->swarmSpawn, 20); - entityCreate(ENTITY_ORC, spawnPos, PLAYER_ENEMY, game); + ecs_entity_t e = entityCreate(ENTITY_ORC, spawnPos, PLAYER_ENEMY, game); + ecs_set(ECS, e, Health, { + .startHP = 80.0f * (1 + wave->data.difficultyScale), + .hp = 80.0f * (1 + wave->data.difficultyScale), + .lastChanged = -1000.0f, + }); wave->orcsElapsed -= timeForOrc; wave->orcsToSend--; }