aboutsummaryrefslogtreecommitdiff
path: root/enemy.c
diff options
context:
space:
mode:
Diffstat (limited to 'enemy.c')
-rw-r--r--enemy.c44
1 files changed, 44 insertions, 0 deletions
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);
+ }
}
}
}