Navigating between rooms

An adventure game would be quite boring if everything took place in one incredibly large room. Not only is it not very efficient, but the world will also lack the feeling of exploration. Switching from one room to another is easy to do, but it does pose a problem.

The first issue is retaining the player stats, such as health, from one room to the next. One solution to this is to activate persistence on the player. Persistence means that we only need to place a single instance of an object in a room, and from that point onwards it will remain in the game world.

The second issue is where to place the player in a room with multiple entry points. If the player isn't persistent, we can place the player in the room, but it would ...

Get HTML5 Game Development with GameMaker now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.