Add hurt sounds, fix sound playing

This commit is contained in:
2024-02-10 15:12:18 +01:00
parent 20af3967a8
commit f08b38664c
2 changed files with 5 additions and 1 deletions

View File

@@ -22,6 +22,9 @@ void damageEvent(ecs_entity_t entity, DamageEvent event) {
bloodEmitter.targetParticles = ecs_id(ParticleLayer1);
ecs_set_ptr(ECS, bloodEmitterEntity, ParticleEmitter, &bloodEmitter);
SoundState *sounds = ecs_singleton_get_mut(ECS, SoundState);
bool status = soundsPosPlay(sounds, center, getRandomSoundType(SOUND_HURT_1, SOUND_HURT_3));
Vector2 pos = {
event.hitbox.x + event.hitbox.width * 0.5f + randFloatRange(-2, 2),
event.hitbox.y + randFloatRange(2, 4)