From 9acbfbafabdddf13eecd72dd661aec6fe77e8875 Mon Sep 17 00:00:00 2001 From: Forest Belton <65484+forestbelton@users.noreply.github.com> Date: Thu, 1 Jul 2021 06:04:29 -0400 Subject: [PATCH] Fix horizontal flip for player metasprite --- src/player.s | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/player.s b/src/player.s index 1aafa71..5afcc70 100644 --- a/src/player.s +++ b/src/player.s @@ -119,7 +119,7 @@ Player_Update:: dec [hl] ret -; Update sprite OAM entries with current position and direction +; Update player metasprite with positional data update_oam: ld hl, PLAYER_DIR ld a, [hl-] ; dir (0 = right , $ff = left) @@ -191,4 +191,22 @@ update_oam: inc hl ld [hl], c + ; flip tile indices if necessary + ld a, c + or c + jr z, .done + + ld_OAM_tile hl, SPRITE_OAM_IDX + ld [hl], SPRITE_IDX + 1 + + ld_OAM_tile hl, SPRITE_OAM_IDX + 1 + ld [hl], SPRITE_IDX + + ld_OAM_tile hl, SPRITE_OAM_IDX + 2 + ld [hl], SPRITE_IDX + 3 + + ld_OAM_tile hl, SPRITE_OAM_IDX + 3 + ld [hl], SPRITE_IDX + 2 + +.done: ret