; updated
+ ; finish the current animation
+ ; and transfer control to the next frame
+ ; input:
+ ; bc: animation ptr
+anim_finish:
+ xor a, a ; set type to 0
+ ld [bc], a
+ ret
+
; animation update calls
; inputs for all:
; bc: current animation ptr
; inputs:
; anim_p0/p1: ptr to y/x position
; anim_p2: direction
-
+ ; anim_p3: frames of movemnet
anim_walk_simple:
+ ; 1) check direction
+
+ ; bc = anim type
+ inc bc
+ inc bc
+ ; bc = p0
+
+ ; load ptr to y/x
+ inc bc
+ ld a, [bc]
+ ld h, a
+ inc bc
+ ld a, [bc]
+ ld l, a
+ ; hl = ptr to y/x
+
+ ; bc = p2
+ ld a, [bc]
+
+ ; jump to direction
+ cp a, NORTH
+ jr z, @north REL
+
+ cp a, SOUTH
+ jr z, @south REL
+
+ cp a, EAST
+ jr z, @east REL
+
+ cp a, WEST
+ jr z, @west REL
+
+ ; invalid direction PANIC
+ jp panic
+@west:
+
+ ret
+@east:
+
+ ret
+@north:
+
+ ret
+@south:
ret