ld [anim_move_y], a
ret
+ ; verify actor animation
+ ; by checking for collision
+ ; clear anim memory if check fails
+ ; inputs:
+ ; bc: actor ptr
+actor_anim_verify:
+ inc bc ; bc = y/x
+ ld a, [bc]
+
+ ; TODO implement
+
+ dec bc
+ ret
+
; function ptrs for each actor type
; inputs:
; bc: actor ptr
cp a, 3
call z, actor_right
+ ; check anim collision
+ call actor_anim_verify
+
turn_finish
@skip:
ld a, RF_WALL
ld [ct_mask], a
- ; tmp = y movement offset
- ; tmp+1 = x movement offset
+ ; anim_target_y = y movement target
+ ; anim_target_x = x movement target
; load tmp and +1 with the current position by
; default
ld a, [hl+]
- ld [tmp], a
+ ld [anim_target_y], a
ld a, [hl]
dec hl
- ld [tmp+1], a
+ ld [anim_target_x], a
; input handling
input_held BTNDOWN
; set expected offset
ld a, ANIM_MOVE_TILE_SIZE
add a, [hl]
- ld [tmp], a
+ ld [anim_target_y], a
call play_noise
turn_finish
; set expected offset
ld a, 0xFF - ANIM_MOVE_TILE_SIZE + 1
add a, [hl]
- ld [tmp], a
+ ld [anim_target_y], a
call play_noise
turn_finish
inc hl
add a, [hl]
dec hl
- ld [tmp+1], a
+ ld [anim_target_x], a
call play_noise
turn_finish
inc hl
add a, [hl]
dec hl
- ld [tmp+1], a
+ ld [anim_target_x], a
call play_noise
turn_finish
; if any collision happens now
; we stop the animation
push hl ; need to save hl
- ld a, [tmp]
+ ld a, [anim_target_y]
add a, 8
ld d, a ; d = target y + 8 to center on tile
- ld a, [tmp+1]
+ ld a, [anim_target_x]
add a, 8
ld e, a ; e = target x + 8 to center on tile
call collision_tile