Lightbearer: Doors and Keys


Today, I worked on implementing a system of doors and keys into the game. I wanted to add a bit of puzzle-solving to the gameplay, and I thought that doors and keys would be a good way to do that.

I started by creating a few different types of doors. Some doors are open by default and allow the player to pass through them to the next level, while others are locked and require the player to find a key before they can be opened.

Opened and closed doors in Lightbearer

Left: closed door, right: open door

To make this work, I created a "player_with_key" group that the game checks when the player collides with a closed door. If the player is in the "player_with_key" group, then the game replaces the closed door with an open one, allowing the player to pass through.

To add keys to the game, I added a key sprite that the player can collect by colliding with it. When the player collides with a key, the game adds the player to the "player_with_key" group, indicating that the player now has a key and can open locked doors. 

A key and a closed door in Lightbearer

There currently is only one type of key and one type of door

Overall, I am happy with the progress I made today. The game is starting to feel more complete, and I am excited to see what levels I can build with this system.

In the future, I could extend the door and key system in a few different ways. One option would be to add more types of keys that open different types of doors. For example, a silver key could open silver doors, and a gold key could open gold doors. This would add another layer of complexity to the puzzle-solving aspect of the game.

Another option would be to add more obstacles that require the player to have a certain item or ability to overcome. For example, the player might need a ladder to climb over a wall, or a pickaxe to break through a barricade.

Finally, I could also add different types of doors that require the player to solve a puzzle or complete a challenge before they can be opened. This would make the game even more challenging and would require the player to think creatively to progress through the levels.

There are many ways that the door and key system could be extended in the future, and I am excited to explore these possibilities further.

Leave a comment

Log in with itch.io to leave a comment.