Browse Source

Fix horizontal flip for player metasprite

master
Forest Belton 3 years ago
parent
commit
9acbfbafab
1 changed files with 19 additions and 1 deletions
  1. +19
    -1
      src/player.s

+ 19
- 1
src/player.s View File

@ -119,7 +119,7 @@ Player_Update::
dec [hl] dec [hl]
ret ret
; Update sprite OAM entries with current position and direction
; Update player metasprite with positional data
update_oam: update_oam:
ld hl, PLAYER_DIR ld hl, PLAYER_DIR
ld a, [hl-] ; dir (0 = right , $ff = left) ld a, [hl-] ; dir (0 = right , $ff = left)
@ -191,4 +191,22 @@ update_oam:
inc hl inc hl
ld [hl], c 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 ret

Loading…
Cancel
Save