diff options
author | quou <quou@disroot.org> | 2023-05-06 20:30:58 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2023-05-06 20:30:58 +1000 |
commit | a72420a85fdfe85d6a6e67b8c70ed11537d532bd (patch) | |
tree | 387ce06b39590ba1b90935fcbf71ed03c4f912b9 /enemy.c | |
parent | 2e0f7c263b197d72fea7701d566e4a62e892fefe (diff) |
Work on visual effects; Debris and player bullet impact effects.
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); + } } } } |