Prev: 51866 Up: Map Next: 51982
51955: 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 51955 POP HL Unstack the size of the room in X and Y.
Work out the coordinate of the east edge of the room.
51956 LD A,L Copy L to A.
51957 ADD A,128 Add 128.
51959 LD L,A Copy it to L.
Add the speed in X to the X coordinate, and take the width of the player off it.
51960 LD A,(IX+1) Fetch the x position of the player.
51963 ADD A,(IX+9) Add the speed along the x axis.
51966 SUB (IX+4) Subtract the width of the player.
Compare it with the east edge.
51969 CP L Return if the player is still in the room.
51970 RET C
51971 LD (IX+1),255 Write 255 to the x position.
Fetch the room number and stash it in L.
51975 LD A,(IX+8) Fetch the room number.
51978 LD L,A Copy it to L.
51979 INC A Go to the room to the east.
51980 JR ChangeRoomEastWest Jump to ChangeRoomEastWest.
View the equivalent code in;
Prev: 51866 Up: Map Next: 51982