diff options
Diffstat (limited to 'src/bullets.c')
| -rw-r--r-- | src/bullets.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/bullets.c b/src/bullets.c index 403b1b6..9441ead 100644 --- a/src/bullets.c +++ b/src/bullets.c @@ -159,26 +159,11 @@ bool check_if_bullet_collided_with_zombie(bullet* b, platform_window* window, pl if (result) { b->endy = intersect_point_of_closest_zombie.y; b->endx = intersect_point_of_closest_zombie.x; - zombies[index_of_closest_zombie].health -= b->damage; - b->damage = 0; - - // Random chunks when zombie is hit. - if (rand() % 5 == 0) { - spawn_zombie_chunk(get_center_of_square(zombies[index_of_closest_zombie].position, zombies[index_of_closest_zombie].size)); - } - - if (zombies[index_of_closest_zombie].health <= 0) { - vec3f center = get_center_of_square(zombies[index_of_closest_zombie].position, zombies[index_of_closest_zombie].size); - spawn_zombie_splatter(center); - - // Random chunks when zombie dies. - int chunk_count = rand() % 4 + 1; - for (int c = 0; c < chunk_count; c++) spawn_zombie_chunk(center); - - zombies[index_of_closest_zombie].alive = false; - spawn_drop(zombies[index_of_closest_zombie].position); + + if (hit_zombie(index_of_closest_zombie, b->damage)) { p->kills++; } + b->damage = 0; } return result; |
