From 40c151a86be954fac3af769a7b21b8186d7db230 Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Fri, 19 Apr 2024 09:07:20 -0600 Subject: [PATCH] feat: render "shadow" --- main.asm | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/main.asm b/main.asm index 268eff3..48c1805 100644 --- a/main.asm +++ b/main.asm @@ -42,10 +42,6 @@ WaitVBlank: call Memcopy ; Reset positions - ld hl, wSimplePosition - ld a, 8 - ld [hl], a - ld hl, wMetaspritePosition.x ld a, 0 ld [wMetaspritePosition.x], a @@ -168,7 +164,7 @@ Main: ld c, a ld [wMetaspritePosition.z+1], a -.jumpend +.jumpend: ld a, [wJoypadState] bit PADB_B, a @@ -184,7 +180,7 @@ Main: ld [wMetaspritePosition.z], a jr .fallend -.fall +.fall: ld a, [wMetaspritePosition.z] sub a, 16 ld b, a @@ -193,16 +189,9 @@ Main: sbc 0 ld c, a ld [wMetaspritePosition.z+1], a -.fallend - - ld de, $0100 - ld c, 8 - ld b, 16 - call RenderSimpleSprite - - ld hl, wSimplePosition - inc [hl] +.fallend: + ; Render the player ; load de ld a, [wMetaspritePosition.x] ld e, a @@ -224,6 +213,23 @@ Main: ld hl, CatMetasprite 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] inc a ldh [hFrameCounter], a @@ -431,11 +437,11 @@ CatMetasprite: db 24, 12, 0, 0 db 128 -SECTION "Position Vars", WRAM0 -; 8-bit X position -wSimplePosition: - ds 1 +ShadowMetasprite: + db 24, 12, 0, 0 + db 128 +SECTION "Position Vars", WRAM0 ; Q12.4 fixed-point X posiition wMetaspritePosition: .x: