From a72420a85fdfe85d6a6e67b8c70ed11537d532bd Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 6 May 2023 20:30:58 +1000 Subject: Work on visual effects; Debris and player bullet impact effects. --- enemy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'enemy.c') diff --git a/enemy.c b/enemy.c index 8b2642f..332a769 100644 --- a/enemy.c +++ b/enemy.c @@ -1,5 +1,6 @@ #include "bullet.h" #include "components.h" +#include "debris.h" #include "game_config.h" #include "sprite.h" #include "standard.h" @@ -44,6 +45,44 @@ Entity new_skull(World* world, int x, int y) { return e; } +static void new_skull_debris(World* world, int x, int y) { + new_debris( + world, + x, + y, + -2 << fbits, -2 << fbits, + sprite_skull_debris_1 + ); + new_debris( + world, + x, + y, + 0, -2 << fbits, + sprite_skull_debris_2 + ); + new_debris( + world, + x, + y, + -2 << fbits, 0, + sprite_skull_debris_3 + ); + new_debris( + world, + x, + y, + 0, 2 << fbits, + sprite_skull_debris_4 + ); + new_debris( + world, + x, + y, + 2 << fbits, 2 << fbits, + sprite_skull_debris_5 + ); +} + void enemy_system(World* world) { /* Skulls. */ int i; @@ -63,6 +102,11 @@ void enemy_system(World* world) { enemy = &world->enemies[i]; if (enemy->hp <= 0) { destroy_entity(world, i); + + if ((bits & ctype_position) && (bits & ctype_skull)) { + pos = &world->positions[i]; + new_skull_debris(world, pos->x, pos->y); + } } } } -- cgit v1.2.3-54-g00ecf