aboutsummaryrefslogtreecommitdiff
path: root/enemy.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 20:30:58 +1000
committerquou <quou@disroot.org>2023-05-06 20:30:58 +1000
commita72420a85fdfe85d6a6e67b8c70ed11537d532bd (patch)
tree387ce06b39590ba1b90935fcbf71ed03c4f912b9 /enemy.c
parent2e0f7c263b197d72fea7701d566e4a62e892fefe (diff)
Work on visual effects; Debris and player bullet impact effects.
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);
+ }
}
}
}