I added this code into a post somewhere, but it is getting kind of hard to find now so I figured I would stick it in this board. If you are using dosbox and the mouse is not locked inside your game window, it can be kind of a pain sometimes to get your ego close enough to the edge of the screen to trigger the room change. This will add a gutter around the edge, so that really you only have to get close now. How close is entirely up to you.
First in the main script, let's go ahead and add a new global variable. It is this variable which will let you set how far from the edge should trigger the new room.
gEdgeDistance = 10
Now in the ego script. We are going to change the doit method of the ego actor. In this, I use the gEdgeDistance literally for the x dimensions, but that number seems a bit big when talking in the y. So I make it look at half that distance for the y's.
(method (doit)
(super:doit())
= edgeHit
(if (<= x (+ 0 gEdgeDistance))
4
)
(else
(if (>= x (- 320 gEdgeDistance))
2
)
(else
(if (>= y (- 190 (/ gEdgeDistance 2)))
3
)
(else
(if (<= y (+ (send gRoom:horizon) (/ gEdgeDistance 2)))
1
)
(else
0
)
)
)
)
)
And there you go, much easier now to travel between rooms.