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