animation: added basic delay for animation
authorLukas Krickl <lukas@krickl.dev>
Mon, 8 Sep 2025 21:10:39 +0000 (23:10 +0200)
committerLukas Krickl <lukas@krickl.dev>
Mon, 8 Sep 2025 21:10:39 +0000 (23:10 +0200)
This probably needs a real animation timer per frame

src/animation.s

index 604be83875b584507c268e60b1678b5dd6429e3c..0af70744a106914768278c6e2daf6d8911dd4adf 100644 (file)
@@ -2,8 +2,13 @@ player_anim_table:
        anim_ent 0, 8, 0x8C, OAM_FXFLIP 
        anim_ent 0, 0, 0x8E, OAM_FXFLIP
        anim_ent 0, 0, 0x00, 0
-       dw player_anim_table
+       dw player_anim_table_f2
 
+player_anim_table_f2:
+       anim_ent 1, 8, 0x8C, OAM_FXFLIP 
+       anim_ent 1, 0, 0x8E, OAM_FXFLIP
+       anim_ent 0, 0, 0x00, 0
+       dw player_anim_table
        
        ; translates tile to screen
        ; inputs:
@@ -94,14 +99,21 @@ unit_draw:
        call unit_draw_obj
        call unit_draw_obj
        call unit_draw_obj
-
+       
        ; load next anim table
+       ; every few frames
+       ld a, [frame_count]
+       cp a, 4 
+       jr nz, @no_new_frame REL
+
        ld hl, act_anim_table
+       add hl, de
        ld a, [bc]
        ld [hl+], a
        inc bc
        ld a, [bc]
        ld [hl], a
+@no_new_frame:
   ret
 
        ; draws a single object