Properly scale enemy wave health scale
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
mkdir build_web
|
mkdir build_web
|
||||||
pushd build_web || exit
|
pushd build_web || exit
|
||||||
|
|
||||||
emcmake cmake .. -DPLATFORM=Web
|
emcmake cmake -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release ..
|
||||||
emmake make
|
emmake make
|
||||||
|
|
||||||
mv PixelDefense.html index.html
|
mv PixelDefense.html index.html
|
||||||
|
|||||||
16
game/wave.c
16
game/wave.c
@@ -44,7 +44,7 @@ WaveInfo getWaveInfo(const EnemyWaves *waves, i32 idx) {
|
|||||||
WaveData waveData;
|
WaveData waveData;
|
||||||
if (idx >= waves->numWaves) {
|
if (idx >= waves->numWaves) {
|
||||||
waveData = waves->waves[waves->numWaves - 1];
|
waveData = waves->waves[waves->numWaves - 1];
|
||||||
waveData.difficultyScale += (idx - waves->numWaves) * 0.1f;
|
waveData.difficultyScale += (idx - waves->numWaves) * 0.25f;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
waveData = waves->waves[idx];
|
waveData = waves->waves[idx];
|
||||||
@@ -78,7 +78,12 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) {
|
|||||||
f32 timeForGoblin = 1.0f / wave->data.goblinSendRate;
|
f32 timeForGoblin = 1.0f / wave->data.goblinSendRate;
|
||||||
while (wave->goblinsToSend > 0 && 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);
|
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->goblinsElapsed -= timeForGoblin;
|
||||||
wave->goblinsToSend--;
|
wave->goblinsToSend--;
|
||||||
}
|
}
|
||||||
@@ -86,7 +91,12 @@ void updateWave(WaveInfo *wave, Game *game, f32 dt) {
|
|||||||
f32 timeForOrc = 1.0f / wave->data.orcSendRate;
|
f32 timeForOrc = 1.0f / wave->data.orcSendRate;
|
||||||
while (wave->orcsToSend > 0 && 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);
|
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->orcsElapsed -= timeForOrc;
|
||||||
wave->orcsToSend--;
|
wave->orcsToSend--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user