From 1ae6a63f79edd72aa39c7f7e2bca5182a68592b4 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 10 Jul 2023 23:06:59 +0100 Subject: Draw entities in order This makes a difference on the less powerful machines and helps avoiding flickering. --- src/game.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 1e376a6..7d64224 100644 --- a/src/game.c +++ b/src/game.c @@ -186,8 +186,8 @@ next_stage: blit_target(TARGET_SCREEN); put_text(136, 100, "READY?", 1); + entities_sort(); entities_draw(); - player_draw(); /* wait some time */ wait_frames(96); @@ -197,7 +197,6 @@ next_stage: blit_copy_all(); entities_draw(); - player_draw(); timer_start(GAME_TIME_MAX, &clock_updated); @@ -264,21 +263,20 @@ next_stage: } if (time && tmonster) { - tmonster->used = 0; + tmonster->used = USED_FREE; tmonster = NULL; } } entities_update(); + entities_sort(); wait_vsync(); /* prevent interrupts so updating the audio doesn't result in sprite * flickering on the less powered machines */ disable(); - player_erase(); entities_draw(); - player_draw(); enable(); if (gameover) -- cgit v1.2.3