aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-08 12:46:24 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-08 12:46:24 +0100
commit6f18c3bae8c64ad52b541f95dde10110697e8b20 (patch)
tree7e14c32f120cbab32875043ecb51343586a73378
parentf515c558088a232e0796bfb3e46b6d969f5f204a (diff)
downloadgold-mine-run-6f18c3bae8c64ad52b541f95dde10110697e8b20.tar.gz
gold-mine-run-6f18c3bae8c64ad52b541f95dde10110697e8b20.zip
Don't draw the player out of screen
We don't have clipping now, so we can't draw out of the screen. Also we want to NOT draw the player during the gameover delay.
-rw-r--r--src/player.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/player.c b/src/player.c
index 7394857..8c1765a 100644
--- a/src/player.c
+++ b/src/player.c
@@ -95,7 +95,7 @@ static void player_dying()
for (uint8_t i = 0; i < steps; i++)
{
/* exit screen */
- if (y > MAP_H * MAP_TILE_H)
+ if (y == MAP_H * MAP_TILE_H - 16)
{
/* if there are lifes left, respawn */
if (dec_lives())
@@ -106,6 +106,8 @@ static void player_dying()
/* stop falling */
gravity = GRAVITY_OFF;
+ /* don't draw the player; XXX: magic number */
+ invuln = 4;
return;
}
y++;