From 83cbe80dd9c07ebe767d92d97c1dfe447e264751 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 29 Jun 2023 23:19:10 +0100 Subject: Collect pickups even if invulnerable --- src/pickup.c | 2 +- src/player.c | 10 +++++++++- src/player.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pickup.c b/src/pickup.c index e1ad424..044e3ef 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -188,7 +188,7 @@ void pickup_update(Entity *e) } } - if (player_collision(e)) + if (player_collision_pickup(e)) { switch (e->flags) { diff --git a/src/player.c b/src/player.c index 71c951a..a8a75cf 100644 --- a/src/player.c +++ b/src/player.c @@ -297,7 +297,15 @@ void player_draw() uint8_t player_collision(Entity *e) { - if (invuln || dying) + if (invuln) + return 0; + + return player_collision_pickup(e); +} + +uint8_t player_collision_pickup(Entity *e) +{ + if (dying) return 0; if (y < e->y + 16 && e->y < y + 16 diff --git a/src/player.h b/src/player.h index 104bfee..4d32881 100644 --- a/src/player.h +++ b/src/player.h @@ -8,6 +8,7 @@ void player_erase(); void player_draw(); uint8_t player_collision(Entity *e); +uint8_t player_collision_pickup(Entity *e); void player_hit(); #endif /* _PLAYER_H */ -- cgit v1.2.3