Prev: B055 Up: Map Next: B0AD
B06B: Handle Circuit Mouse
The handler for the robot mice (objects 5E and 5F) which run in circuits. When a mouse is blocked, or is not moving, it makes a noise and turns a quarter turn one way or the other, chosen at random. Its speed is then set from the way it faces, and doubled.
Input
IX The address of the object
Move, or turn if the mouse is blocked.
HandleCircuitMouse B06B CALL SetPixelAdjustments_Mouse Call SetPixelAdjustments_Mouse.
B06E CALL ExtendObjectDownwards Call ExtendObjectDownwards.
B071 LD A,(IX+$09) Jump to HandleCircuitMouse_Turn if the mouse is not moving.
B074 OR (IX+$0A)
B077 JR Z,HandleCircuitMouse_Turn
B079 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
B07C LD A,(IX+$0B) Call PlaySoundFromHeight if it is rising or falling.
B07F AND A
B080 CALL NZ,PlaySoundFromHeight
B083 LD A,(IX+$0C) Fetch the collision flags.
B086 AND %00000011 Keep bits 0 and 1.
B088 JR Z,HandleCircuitMouse_Finish Jump to HandleCircuitMouse_Finish if the mouse has not been blocked.
HandleCircuitMouse_Turn B08A CALL PlayBumpSound Call PlayBumpSound.
B08D LD A,($5B05) Fetch RandomSeed2.
B090 AND %00000001 Keep bit 0.
B092 JR Z,HandleCircuitMouse_TurnOneWay Jump to HandleCircuitMouse_TurnOneWay if it is zero.
B094 CALL TurnMouseOtherWay Call TurnMouseOtherWay.
HandleCircuitMouse_SetSpeed B097 CALL SetMouseSpeed Call SetMouseSpeed.
B09A SLA (IX+$09) Double the speed along the x axis.
B09E SLA (IX+$0A) Double the speed along the y axis.
HandleCircuitMouse_Finish B0A2 CALL RestoreObjectHeight Call RestoreObjectHeight.
B0A5 JP SetDeadlyFlagsAndDraw Jump to SetDeadlyFlagsAndDraw.
HandleCircuitMouse_TurnOneWay B0A8 CALL TurnMouseOneWay Call TurnMouseOneWay.
B0AB JR HandleCircuitMouse_SetSpeed Jump to HandleCircuitMouse_SetSpeed.
Prev: B055 Up: Map Next: B0AD