Prev: 29753 Up: Map Next: 29881
29863: Randomise Helicopter Position
Used by the routines at Handler_Helicopter and Reset_UFO_Position.
Generates a random position for the helicopter and validates it. Keeps generating new coordinates until a valid position is found, then clears the spawning flag.
Input
IX Pointer to helicopter sprite data
IY Pointer to helicopter state data
Randomise_Position_Loop 29863 CALL Generate_Random_Number Generate a random X coordinate in C and a random Y coordinate in B by calling Generate_Random_Number twice.
29866 LD C,A
29867 CALL Generate_Random_Number
29870 LD B,A
29871 CALL Validate_Position Call Validate_Position and jump back to Randomise_Position_Loop if the position is invalid.
29874 JR C,Randomise_Position_Loop
29876 RES 7,(IY+0) Clear bit 7 of *IY+0 (mark the helicopter as active/no longer spawning).
29880 RET Return.
Prev: 29753 Up: Map Next: 29881