Prev: 41961 Up: Map Next: 42035
41990: Start Tumbling
Makes Sabreman tumble. The sprite becomes 24 (the first of the tumbling frames) and the y velocity is set to 192 so that he is thrown upwards. Bit 7 of the redraw flags is cleared.
If the x velocity is zero it is set to 2 or 254 depending on bit 7 of the system variable FRAMES (23672), 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 41990 LD (IX+0),24 Set the sprite id to 24 (tumbling).
41994 LD (IX+9),192 Set the y velocity to 192 (up).
41998 RES 7,(IX+15) Clear bit 7 of the redraw flags.
42002 LD A,(IX+6) Fetch the x velocity.
42005 AND A Jump to Start_Tumbling_Reverse_Velocity if he is moving sideways.
42006 JR NZ,Start_Tumbling_Reverse_Velocity
42008 LD (IX+6),2 Set the x velocity to 2.
42012 LD A,(23672) Fetch the low byte of FRAMES.
42015 AND %10000000 Keep only bit 7.
42017 JP Z,Update_Object_Sprite Jump to Update_Object_Sprite if the bit is clear.
42020 LD (IX+6),254 Set the x velocity to 254.
42024 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Start_Tumbling_Reverse_Velocity 42027 NEG Negate the x velocity.
42029 LD (IX+6),A Set the new x velocity.
42032 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Prev: 41961 Up: Map Next: 42035