Prev: 7439 Up: Map Next: 74B9
74A7: 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 74A7 CALL Generate_Random_Number Generate a random X coordinate in C and a random Y coordinate in B by calling Generate_Random_Number twice.
74AA LD C,A
74AB CALL Generate_Random_Number
74AE LD B,A
74AF CALL Validate_Position Call Validate_Position and jump back to Randomise_Position_Loop if the position is invalid.
74B2 JR C,Randomise_Position_Loop
74B4 RES 7,(IY+$00) Clear bit 7 of *IY+00 (mark the helicopter as active/no longer spawning).
74B8 RET Return.
Prev: 7439 Up: Map Next: 74B9