Prev: 6EA8 Up: Map Next: 6EC0
6EAC: Set Random Speeds
Used by the routines at HandleCheese and HandleSugar.
Sets the horizontal speed and the vertical speed of an actor to either 02 or FE (-2), at random. The new vertical speed is also left in A.
Input
IX Actor
Output
A The new vertical speed
SetRandomSpeeds 6EAC LD A,R Fetch a random number.
6EAE AND %00000100 Keep only bit 2.
6EB0 SUB $02 Subtract 02 so that the speed is FE or 02.
6EB2 LD (IX+$04),A Update the horizontal speed.
6EB5 LD A,R Fetch a random number.
6EB7 RRA Shift the random number right.
6EB8 AND %00000100 Keep only bit 2.
6EBA SUB $02 Subtract 02 so that the speed is FE or 02.
6EBC LD (IX+$05),A Update the vertical speed.
6EBF RET Return.
Prev: 6EA8 Up: Map Next: 6EC0