Prev: 51955 Up: Map Next: 52009
51982: Leave Room To The North
Sends the player to the room to the north if it has gone past the north edge of the room. The y position is set to 255, which PlacePlayerAtDoor takes as the sign that the player has come out of the north and puts it at the south side of the new room.
Input
HL Distances to the walls along x and y
IX The address of the object
Leave if past the north edge.
LeaveRoomToNorth 51982 POP HL Unstack the size of the room in X and Y.
Work out the coordinate of the north edge of the room.
51983 LD A,H Copy H to A.
51984 ADD A,128 Add 128.
51986 LD H,A Copy it to H.
Add the speed in Y to the Y coordinate, and take the depth of the player off it.
51987 LD A,(IX+2) Fetch the y position of the player.
51990 ADD A,(IX+10) Add the speed along the y axis.
51993 SUB (IX+5) Subtract the depth of the player.
Compare it with the north edge.
51996 CP H Return if the player is still in the room.
51997 RET C
51998 LD (IX+2),255 Write 255 to the y position.
Fetch the room number and add 16 to go to the room to the north.
52002 LD A,(IX+8) Fetch the room number.
52005 ADD A,16 Add 16.
52007 JR ChangeRoom Jump to ChangeRoom.
View the equivalent code in;
Prev: 51955 Up: Map Next: 52009