Doors and Floors

I have been working on moving code around a bit so that it is more manageable. The controlling of the player is now done via the RoomManager object. The reason for this is because I want to be able to still control other things even when the game is paused. When the game is paused, everything except the object that triggered the pause is deactivated, and I want that to include the player.

One of the times the game “pauses” is during camera scroll transitions in the y axis (the axis that goes up and down). Leaving this task to the player character would be impossible if I want a pause effect. This process is entirely handled via the RoomManager. Best of all, the character still knows nothing about the RoomManager. This helps make it portable to other levels, or perhaps even other games.

I have fixed a few platforming bugs, including yesterday’s fall-through-the-floor glitch that happens when you rub a wall too much. Similarly, there was a bug involving the player banging their heads on the ceiling. The problem was similar to the floor bug, so that was an easy fix.

I have been learning today about how Game Maker Studio 2 handles room inheritance. It is similar to object-oriented inheritance that you see in most object-oriented programming languages: the child room has all the same properties as the parent room, any changes you make to the parent room propagate to the child room, and changes made to the child room stay in the child room. This feature is really handy for making what I like to call “flip rooms”. They are essentially doors to the other half of the level.

The main problem I had in implementing this feature is that knowledge of the camera’s position is not retained. I needed to set up global variables that hold these values at all times, then access them when the player flips into the other room.

I am tired now, so I will rest up over the weekend. I will resume work on this when Monday comes.

Leave a Reply

Your email address will not be published. Required fields are marked *