diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-29 23:19:10 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-29 23:19:10 +0100 |
commit | 83cbe80dd9c07ebe767d92d97c1dfe447e264751 (patch) | |
tree | 4043eceeb4bda5bfa1edf31d8d95c2b50e242c08 | |
parent | b176d3779cbc3d0d02d6651b082cd5011522f7be (diff) | |
download | gold-mine-run-83cbe80dd9c07ebe767d92d97c1dfe447e264751.tar.gz gold-mine-run-83cbe80dd9c07ebe767d92d97c1dfe447e264751.zip |
Collect pickups even if invulnerable
-rw-r--r-- | src/pickup.c | 2 | ||||
-rw-r--r-- | src/player.c | 10 | ||||
-rw-r--r-- | 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 */ |