Prev: 28328 Up: Map Next: 28352
28332: Set Random Speeds
Used by the routines at HandleCheese and HandleSugar.
Sets the horizontal speed and the vertical speed of an actor to either 2 or 254 (-2), at random. The new vertical speed is also left in A.
Input
IX Actor
Output
A The new vertical speed
SetRandomSpeeds 28332 LD A,R Fetch a random number.
28334 AND %00000100 Keep only bit 2.
28336 SUB 2 Subtract 2 so that the speed is 254 or 2.
28338 LD (IX+4),A Update the horizontal speed.
28341 LD A,R Fetch a random number.
28343 RRA Shift the random number right.
28344 AND %00000100 Keep only bit 2.
28346 SUB 2 Subtract 2 so that the speed is 254 or 2.
28348 LD (IX+5),A Update the vertical speed.
28351 RET Return.
Prev: 28328 Up: Map Next: 28352