Prev: 50071 Up: Map Next: 50187
50160: Leave Room To The East
Sends the player to the room to the east if it has gone past the east edge of the room. The x position is set to 255, which PlacePlayerAtDoor takes as the sign that the player has come out of the east and puts it at the west 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 east edge.
LeaveRoomToEast 50160 POP HL Restore HL from the stack.
50161 LD A,L Copy L to A.
50162 ADD A,128 Add 128.
50164 LD L,A Copy it to L.
50165 LD A,(IX+1) Fetch the x position of the player.
50168 ADD A,(IX+9) Add the speed along the x axis.
50171 SUB (IX+4) Subtract the width of the player.
50174 CP L Return if the player is still in the room.
50175 RET C
50176 LD (IX+1),255 Write 255 to the x position.
50180 LD A,(IX+8) Fetch the room number.
50183 LD L,A Copy it to L.
50184 INC A Increment A.
50185 JR ChangeRoomEastWest Jump to ChangeRoomEastWest.
View the equivalent code in;
Prev: 50071 Up: Map Next: 50187