diff options
Diffstat (limited to 'enemy.c')
-rw-r--r-- | enemy.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -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); + } } } } |