Prev: ABDE Up: Map Next: AC0E
ABEF: Set Tribesman Velocity
Used by the routine at HandlerTribesman.
Sets the X velocity of a tribesman and makes it face the way it is going, then chooses a random Y velocity.
Input
A The X velocity
BC Address of the table of velocities at TribesmanVelocities
IX Actor record of the tribesman
SetTribesmanVelocity ABEF LD (IX+$06),A Set the X velocity of the tribesman.
ABF2 AND A Jump to SetTribesmanVelocity_Left if the tribesman is moving left.
ABF3 JP M,SetTribesmanVelocity_Left
ABF6 SET 2,(IX+$00) Set bit 2 of the sprite ID so that the tribesman faces right.
SetTribesmanVelocity_Y ABFA LD A,($5C78) Fetch the low byte of FRAMES.
ABFD AND %00000011 Keep only bits 0-1.
ABFF LD L,A Stash the velocity index in L.
AC00 LD H,$00 Clear H.
AC02 ADD HL,BC Add the table address to get the address of the velocity.
AC03 LD A,(HL) Fetch the Y velocity from the table.
AC04 LD (IX+$07),A Set the Y velocity of the tribesman.
AC07 RET Return.
The tribesman is moving left.
SetTribesmanVelocity_Left AC08 RES 2,(IX+$00) Reset bit 2 of the sprite ID so that the tribesman faces left.
AC0C JR SetTribesmanVelocity_Y Jump to SetTribesmanVelocity_Y.
Prev: ABDE Up: Map Next: AC0E