|
|
@ -1,4 +1,5 @@ |
|
|
|
INCLUDE "hardware.inc" |
|
|
|
INCLUDE "input.inc" |
|
|
|
|
|
|
|
Section "Player Data", WRAM0 |
|
|
|
|
|
|
@ -17,9 +18,9 @@ Section "Player Code", ROM0 |
|
|
|
spriteData: |
|
|
|
INCBIN "png/player.2bpp" |
|
|
|
|
|
|
|
PlayerInit:: |
|
|
|
Player_Init:: |
|
|
|
ld a, 8 |
|
|
|
ld hl, playerScreenX |
|
|
|
ld hl, _OAM + 1 |
|
|
|
ld [hl], a |
|
|
|
|
|
|
|
ld bc, _VRAM8000 |
|
|
@ -27,7 +28,7 @@ PlayerInit:: |
|
|
|
ld d, 16 |
|
|
|
call memcpy |
|
|
|
|
|
|
|
ld hl, playerSprite |
|
|
|
ld hl, _OAM |
|
|
|
ld a, 144-8 |
|
|
|
ld [hli], a |
|
|
|
ld a, 8 |
|
|
@ -37,11 +38,32 @@ PlayerInit:: |
|
|
|
ld [hli], a |
|
|
|
|
|
|
|
ld bc, _OAMRAM |
|
|
|
ld hl, playerSprite |
|
|
|
ld hl, _OAM |
|
|
|
ld d, 4 |
|
|
|
call memcpy |
|
|
|
|
|
|
|
ret |
|
|
|
|
|
|
|
PlayerDraw:: |
|
|
|
Player_Update:: |
|
|
|
ld hl, keys |
|
|
|
ld b, [hl] |
|
|
|
|
|
|
|
; check for move right |
|
|
|
ld a, b |
|
|
|
and BTN_RIGHT |
|
|
|
jr z, .left |
|
|
|
|
|
|
|
ld hl, _OAM + 1 |
|
|
|
inc [hl] |
|
|
|
|
|
|
|
.left: |
|
|
|
; check for move left |
|
|
|
ld a, b |
|
|
|
and BTN_LEFT |
|
|
|
jr z, .done |
|
|
|
|
|
|
|
ld hl, _OAM + 1 |
|
|
|
dec [hl] |
|
|
|
|
|
|
|
.done: |
|
|
|
ret |