Prev: B053 Up: Map Next: B099
B078: Animate Walk
Used by the routine at UpdatePlayerDirection.
Every other frame, if the player has moved, adds one to the animation frame in bits 0-1 of the sprite ID (wrapping from 03 round to 00).
Input
D New Y position
E New X position
IX Actor record of the player
AnimateWalk B078 LD A,($5C78) Fetch the low byte of FRAMES.
B07B AND %00000001 Keep only bit 0.
B07D RET NZ Return if this is an odd frame.
B07E LD A,D Fetch the new Y position.
B07F XOR (IX+$04) Find the difference from the Y position of the player.
B082 LD C,A Stash the Y difference in C.
B083 LD A,E Fetch the new X position.
B084 XOR (IX+$03) Find the difference from the X position of the player.
B087 OR C Return if the player has not moved.
B088 RET Z
B089 LD A,(IX+$00) Fetch the sprite ID of the player.
B08C LD C,A Stash the sprite ID in C.
B08D INC A Move on to the next frame of animation.
B08E AND %00000011 Keep only bits 0-1.
B090 LD B,A Stash the new frame in B.
B091 LD A,C Fetch the old sprite ID.
B092 AND %11111100 Keep only bits 2-7.
B094 OR B Merge in the new frame.
B095 LD (IX+$00),A Set the new sprite ID of the player.
B098 RET Return.
Prev: B053 Up: Map Next: B099