From b7944015f73024050c96549df81de9a2fafd695f Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Mon, 15 Apr 2024 13:56:16 +0800 Subject: [PATCH] Particles when Harmed --- player.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/player.c b/player.c index 5fe067f..04959f9 100644 --- a/player.c +++ b/player.c @@ -163,9 +163,27 @@ void player_Advance(System_Player *sys, Duration deltaTime) { } +static int harmed_particle_count = 20; + void player_HazardHarm(System_Player *sys) { if (!sys->player) return; + + // Emit some particles + for (int i = 0; i < harmed_particle_count; i++) { + double speed_linear = rand_DoubleRange(150, 400); + double angle = rand_Double01() * 2.0 * M_PI; + particle_Emit( + sys->super->particle, + sys->player->super->position->position, + vec2(speed_linear * cos(angle), speed_linear * sin(angle)), + rand_DoubleRange(2, 3), + rand_DoubleRange(5, 30), + rand_DoubleRange(15, 22), + duration_FromSeconds(0), + &render_ModeDefault); + } + sys->player->storedSpeedY = 0; sys->player->super->position->velocity = vec2(0, 0); sys->player->super->position->position = sys->player->hazardRespawn;