fp: Do some wave balancing

This commit is contained in:
Joshalosh 2023-11-02 08:30:37 +11:00
parent 0522e842c4
commit 9ad3754829
2 changed files with 5 additions and 3 deletions

View File

@ -1982,7 +1982,8 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
// the wave countdown until all enemies are killed. // the wave countdown until all enemies are killed.
bool all_enemies_spawned = game->play.enemies_spawned_this_wave >= game->play.enemies_per_wave; bool all_enemies_spawned = game->play.enemies_spawned_this_wave >= game->play.enemies_per_wave;
bool advance_to_next_wave = false; bool advance_to_next_wave = false;
bool current_wave_is_break_for_player = game->play.current_wave % 3 == 0; bool current_wave_is_break_for_player = game->play.current_wave % 1 == 0;
bool monkey_spawn = game->play.current_wave % 3 == 0;
if (current_wave_is_break_for_player) { if (current_wave_is_break_for_player) {
Dqn_usize enemy_count = 0; Dqn_usize enemy_count = 0;
for (FP_GameEntityHandle spawner_handle : game->play.mob_spawners) { for (FP_GameEntityHandle spawner_handle : game->play.mob_spawners) {
@ -2015,7 +2016,7 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
game->play.enemies_spawned_this_wave = 0; // Important! Reset the spawn count game->play.enemies_spawned_this_wave = 0; // Important! Reset the spawn count
game->play.wave_cooldown_timestamp_ms = 0; // Important! We reset the timestamp for the next wave game->play.wave_cooldown_timestamp_ms = 0; // Important! We reset the timestamp for the next wave
if (current_wave_is_break_for_player && game->play.current_wave != 0) { if (monkey_spawn && game->play.current_wave != 0) {
// NOTE: We spawn a monkey at these wave intervals; // NOTE: We spawn a monkey at these wave intervals;
if (game->play.monkey_spawn_count < 3) { if (game->play.monkey_spawn_count < 3) {
DQN_ASSERT(game->play.monkey_spawn_count < DQN_ARRAY_UCOUNT(game->play.monkey_spawn_shuffled_list)); DQN_ASSERT(game->play.monkey_spawn_count < DQN_ARRAY_UCOUNT(game->play.monkey_spawn_shuffled_list));
@ -2139,7 +2140,7 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
mob->waypoints = FP_SentinelList_Init<FP_GameWaypoint>(game->play.chunk_pool); mob->waypoints = FP_SentinelList_Init<FP_GameWaypoint>(game->play.chunk_pool);
mob->flags |= FP_GameEntityFlag_Aggros; mob->flags |= FP_GameEntityFlag_Aggros;
mob->flags |= FP_GameEntityFlag_RespondsToBuildings; mob->flags |= FP_GameEntityFlag_RespondsToBuildings;
mob->hp_cap *= hp_adjustment; mob->hp_cap *= hp_adjustment*2;
mob->hp = mob->hp_cap; mob->hp = mob->hp_cap;
FP_AppendMobSpawnerWaypoints(game, entity->handle, mob->handle); FP_AppendMobSpawnerWaypoints(game, entity->handle, mob->handle);

View File

@ -185,6 +185,7 @@ static FP_GameEntityHandle FP_Entity_CreateTerryInternal(FP_Game *game, Dqn_V2 p
entity->local_hit_box_size = FP_Game_MetersToPixelsNx2(game->play, 0.5f, entity->sprite_height.meters * .6f); entity->local_hit_box_size = FP_Game_MetersToPixelsNx2(game->play, 0.5f, entity->sprite_height.meters * .6f);
entity->hp_cap = FP_DEFAULT_DAMAGE * 3; entity->hp_cap = FP_DEFAULT_DAMAGE * 3;
entity->hp = entity->hp_cap; entity->hp = entity->hp_cap;
entity->coins = 10;
FP_Entity_AddDebugEditorFlags(game, result); FP_Entity_AddDebugEditorFlags(game, result);
entity->flags |= FP_GameEntityFlag_NonTraversable; entity->flags |= FP_GameEntityFlag_NonTraversable;
entity->flags |= FP_GameEntityFlag_Attackable; entity->flags |= FP_GameEntityFlag_Attackable;