fp: Clinger dash

This commit is contained in:
doyle 2023-10-08 20:05:40 +11:00
parent 4e9cc3b4ed
commit 0c266e4127
2 changed files with 9 additions and 0 deletions

View File

@ -1715,6 +1715,11 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
if (dist_to_waypoint_sq > DQN_SQUARED(arrival_threshold)) { if (dist_to_waypoint_sq > DQN_SQUARED(arrival_threshold)) {
Dqn_V2 entity_to_waypoint_norm = Dqn_V2_Normalise(entity_to_waypoint); Dqn_V2 entity_to_waypoint_norm = Dqn_V2_Normalise(entity_to_waypoint);
acceleration_meters_per_s = entity_to_waypoint_norm * (entity->base_acceleration_per_s.meters * 0.25f); acceleration_meters_per_s = entity_to_waypoint_norm * (entity->base_acceleration_per_s.meters * 0.25f);
if (entity->type == FP_EntityType_Clinger && game->play.clock_ms >= entity->clinger_next_dash_timestamp) {
entity->clinger_next_dash_timestamp = game->play.clock_ms + 2000;
acceleration_meters_per_s = entity_to_waypoint_norm * entity->base_acceleration_per_s.meters * 45.f;
}
break; break;
} }
@ -2026,6 +2031,9 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
uint32_t max_vary = DQN_CAST(uint32_t)(one_meter * 2.f); uint32_t max_vary = DQN_CAST(uint32_t)(one_meter * 2.f);
waypoint->data.offset += Dqn_V2_InitNx2(DQN_CAST(Dqn_f32)Dqn_PCG32_Range(&game->play.rng, min_vary, max_vary), waypoint->data.offset += Dqn_V2_InitNx2(DQN_CAST(Dqn_f32)Dqn_PCG32_Range(&game->play.rng, min_vary, max_vary),
DQN_CAST(Dqn_f32)Dqn_PCG32_Range(&game->play.rng, min_vary, max_vary)); DQN_CAST(Dqn_f32)Dqn_PCG32_Range(&game->play.rng, min_vary, max_vary));
if (Dqn_PCG32_NextF32(&game->play.rng) >= .5f)
waypoint->data.offset *= -1;
} }
game->play.enemies_spawned_this_wave++; game->play.enemies_spawned_this_wave++;

View File

@ -220,6 +220,7 @@ struct FP_GameEntity
Dqn_usize terry_mobile_data_plan; Dqn_usize terry_mobile_data_plan;
Dqn_usize terry_mobile_data_plan_cap; Dqn_usize terry_mobile_data_plan_cap;
Dqn_usize clinger_next_dash_timestamp;
Dqn_usize coins; Dqn_usize coins;
FP_GameInventory inventory; FP_GameInventory inventory;