feat: render "shadow"

main
Louis Pearson 2024-04-19 09:07:20 -06:00
parent 2ab9a1f3a0
commit 40c151a86b
1 changed files with 25 additions and 19 deletions

View File

@ -42,10 +42,6 @@ WaitVBlank:
call Memcopy call Memcopy
; Reset positions ; Reset positions
ld hl, wSimplePosition
ld a, 8
ld [hl], a
ld hl, wMetaspritePosition.x ld hl, wMetaspritePosition.x
ld a, 0 ld a, 0
ld [wMetaspritePosition.x], a ld [wMetaspritePosition.x], a
@ -168,7 +164,7 @@ Main:
ld c, a ld c, a
ld [wMetaspritePosition.z+1], a ld [wMetaspritePosition.z+1], a
.jumpend .jumpend:
ld a, [wJoypadState] ld a, [wJoypadState]
bit PADB_B, a bit PADB_B, a
@ -184,7 +180,7 @@ Main:
ld [wMetaspritePosition.z], a ld [wMetaspritePosition.z], a
jr .fallend jr .fallend
.fall .fall:
ld a, [wMetaspritePosition.z] ld a, [wMetaspritePosition.z]
sub a, 16 sub a, 16
ld b, a ld b, a
@ -193,16 +189,9 @@ Main:
sbc 0 sbc 0
ld c, a ld c, a
ld [wMetaspritePosition.z+1], a ld [wMetaspritePosition.z+1], a
.fallend .fallend:
ld de, $0100
ld c, 8
ld b, 16
call RenderSimpleSprite
ld hl, wSimplePosition
inc [hl]
; Render the player
; load de ; load de
ld a, [wMetaspritePosition.x] ld a, [wMetaspritePosition.x]
ld e, a ld e, a
@ -224,6 +213,23 @@ Main:
ld hl, CatMetasprite ld hl, CatMetasprite
call RenderMetasprite call RenderMetasprite
; Render the shadow
; load de
ld a, [wMetaspritePosition.x]
ld e, a
ld a, [wMetaspritePosition.x + 1]
ld d, a
; load bc
ld a, [wMetaspritePosition.y]
ld c, a
ld a, [wMetaspritePosition.y + 1]
ld b, a
ld hl, ShadowMetasprite
call RenderMetasprite
ldh a, [hFrameCounter] ldh a, [hFrameCounter]
inc a inc a
ldh [hFrameCounter], a ldh [hFrameCounter], a
@ -431,11 +437,11 @@ CatMetasprite:
db 24, 12, 0, 0 db 24, 12, 0, 0
db 128 db 128
SECTION "Position Vars", WRAM0 ShadowMetasprite:
; 8-bit X position db 24, 12, 0, 0
wSimplePosition: db 128
ds 1
SECTION "Position Vars", WRAM0
; Q12.4 fixed-point X posiition ; Q12.4 fixed-point X posiition
wMetaspritePosition: wMetaspritePosition:
.x: .x: