|
@ -6,13 +6,6 @@ Section "Player Data", WRAM0 |
|
|
playerWorldX: dw |
|
|
playerWorldX: dw |
|
|
playerWorldY: dw |
|
|
playerWorldY: dw |
|
|
|
|
|
|
|
|
; Sprite data |
|
|
|
|
|
playerSprite: |
|
|
|
|
|
playerScreenY: db |
|
|
|
|
|
playerScreenX: db |
|
|
|
|
|
playerTileIndex: db |
|
|
|
|
|
playerFlags: db |
|
|
|
|
|
|
|
|
|
|
|
Section "Player Code", ROM0 |
|
|
Section "Player Code", ROM0 |
|
|
|
|
|
|
|
|
spriteData: |
|
|
spriteData: |
|
@ -45,6 +38,13 @@ Player_Init:: |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
Player_Update:: |
|
|
Player_Update:: |
|
|
|
|
|
; Only update every 2 frames |
|
|
|
|
|
ld hl, frame |
|
|
|
|
|
ld a, [hl] |
|
|
|
|
|
and %1 |
|
|
|
|
|
cp %1 |
|
|
|
|
|
jr nz, .done |
|
|
|
|
|
|
|
|
ld hl, keys |
|
|
ld hl, keys |
|
|
ld b, [hl] |
|
|
ld b, [hl] |
|
|
|
|
|
|
|
@ -59,8 +59,10 @@ Player_Update:: |
|
|
cp 160 |
|
|
cp 160 |
|
|
jr nc, .done |
|
|
jr nc, .done |
|
|
|
|
|
|
|
|
ld hl, _OAM + 1 |
|
|
|
|
|
|
|
|
; Update x-position and set x-flip = false |
|
|
inc [hl] |
|
|
inc [hl] |
|
|
|
|
|
ld hl, _OAM + 3 |
|
|
|
|
|
res 5, [hl] |
|
|
|
|
|
|
|
|
.left: |
|
|
.left: |
|
|
; check for left button |
|
|
; check for left button |
|
@ -74,7 +76,10 @@ Player_Update:: |
|
|
cp 9 |
|
|
cp 9 |
|
|
jr c, .done |
|
|
jr c, .done |
|
|
|
|
|
|
|
|
|
|
|
; Update x-position and set x-flip = true |
|
|
dec [hl] |
|
|
dec [hl] |
|
|
|
|
|
ld hl, _OAM + 3 |
|
|
|
|
|
set 5, [hl] |
|
|
|
|
|
|
|
|
.done: |
|
|
.done: |
|
|
ret |
|
|
ret |