Prev: A3E9 Up: Map Next: A433
A406: Start Tumbling
Makes Sabreman tumble. The sprite becomes 18 (the first of the tumbling frames) and the y velocity is set to C0 so that he is thrown upwards. Bit 7 of the redraw flags is cleared.
If the x velocity is zero it is set to 02 or FE depending on bit 7 of the system variable FRAMES (5C78), which makes the direction random. Otherwise the x velocity is negated, so that he bounces back the way he came.
Input
IX Object record of Sabreman
Start_Tumbling A406 LD (IX+$00),$18 Set the sprite id to 18 (tumbling).
A40A LD (IX+$09),$C0 Set the y velocity to C0 (up).
A40E RES 7,(IX+$0F) Clear bit 7 of the redraw flags.
A412 LD A,(IX+$06) Fetch the x velocity.
A415 AND A Jump to Start_Tumbling_Reverse_Velocity if he is moving sideways.
A416 JR NZ,Start_Tumbling_Reverse_Velocity
A418 LD (IX+$06),$02 Set the x velocity to 02.
A41C LD A,($5C78) Fetch the low byte of FRAMES.
A41F AND %10000000 Keep only bit 7.
A421 JP Z,Update_Object_Sprite Jump to Update_Object_Sprite if the bit is clear.
A424 LD (IX+$06),$FE Set the x velocity to FE.
A428 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Start_Tumbling_Reverse_Velocity A42B NEG Negate the x velocity.
A42D LD (IX+$06),A Set the new x velocity.
A430 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Prev: A3E9 Up: Map Next: A433