|
|
@ -21,15 +21,10 @@ spriteData: |
|
|
|
INCBIN "png/sprite/player.2bpp" |
|
|
|
|
|
|
|
DEF SPRITE_OAM_IDX EQU 0 |
|
|
|
DEF SPRITE_IDX EQU 32 ; tile index, rename later |
|
|
|
DEF SPRITE_WIDTH EQU 2 |
|
|
|
DEF SPRITE_HEIGHT EQU 2 |
|
|
|
DEF PLAYER_SPEED EQU 2 |
|
|
|
|
|
|
|
DEF TILE_WIDTH EQU 8 ; Width of tile in bytes |
|
|
|
DEF TILE_HEIGHT EQU 8 ; Height of tile in bytes |
|
|
|
DEF TILE_SIZE EQU 16 ; Total length of tile in bytes |
|
|
|
|
|
|
|
DEF GRAVITY EQU (0 << 8) | $2e ; 0.18 |
|
|
|
DEF INIT_VY EQU (3 << 8) | $99 ; 3.60 |
|
|
|
DEF INIT_FALL_VY EQU ($ff << 8) | $1a ; -1.1015625 |
|
|
@ -44,7 +39,7 @@ Player_Init:: |
|
|
|
ENDR |
|
|
|
|
|
|
|
; Copy sprite to VRAM |
|
|
|
ld bc, _VRAM8000 + SPRITE_IDX * TILE_SIZE |
|
|
|
ld bc, _VRAM8000 + TILE_INDEX_PLAYER * TILE_SIZE |
|
|
|
ld hl, spriteData |
|
|
|
ld d, TILE_SIZE * (SPRITE_WIDTH * SPRITE_HEIGHT) |
|
|
|
call memcpy |
|
|
@ -268,7 +263,7 @@ Player_UpdateOAM:: |
|
|
|
ld [hli], a |
|
|
|
ld [hl], b |
|
|
|
inc hl |
|
|
|
ld [hl], SPRITE_IDX |
|
|
|
ld [hl], TILE_INDEX_PLAYER |
|
|
|
inc hl |
|
|
|
ld [hl], c |
|
|
|
inc hl |
|
|
@ -283,7 +278,7 @@ Player_UpdateOAM:: |
|
|
|
ld [hli], a |
|
|
|
ld [hl], b |
|
|
|
inc hl |
|
|
|
ld [hl], SPRITE_IDX + 1 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 1 |
|
|
|
inc hl |
|
|
|
ld [hl], c |
|
|
|
inc hl |
|
|
@ -299,7 +294,7 @@ Player_UpdateOAM:: |
|
|
|
ld [hli], a |
|
|
|
ld [hl], b |
|
|
|
inc hl |
|
|
|
ld [hl], SPRITE_IDX + 2 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 2 |
|
|
|
inc hl |
|
|
|
ld [hl], c |
|
|
|
inc hl |
|
|
@ -314,7 +309,7 @@ Player_UpdateOAM:: |
|
|
|
ld [hli], a |
|
|
|
ld [hl], b |
|
|
|
inc hl |
|
|
|
ld [hl], SPRITE_IDX + 3 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 3 |
|
|
|
inc hl |
|
|
|
ld [hl], c |
|
|
|
|
|
|
@ -325,16 +320,16 @@ Player_UpdateOAM:: |
|
|
|
|
|
|
|
; TODO: Can be sped up by using LD A, [NN] |
|
|
|
ld_OAM_tile hl, SPRITE_OAM_IDX |
|
|
|
ld [hl], SPRITE_IDX + 1 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 1 |
|
|
|
|
|
|
|
ld_OAM_tile hl, SPRITE_OAM_IDX + 1 |
|
|
|
ld [hl], SPRITE_IDX |
|
|
|
ld [hl], TILE_INDEX_PLAYER |
|
|
|
|
|
|
|
ld_OAM_tile hl, SPRITE_OAM_IDX + 2 |
|
|
|
ld [hl], SPRITE_IDX + 3 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 3 |
|
|
|
|
|
|
|
ld_OAM_tile hl, SPRITE_OAM_IDX + 3 |
|
|
|
ld [hl], SPRITE_IDX + 2 |
|
|
|
ld [hl], TILE_INDEX_PLAYER + 2 |
|
|
|
|
|
|
|
.done: |
|
|
|
ret |
|
|
|