03 / Devlog, Sep 20 '23: level design
GitHub: https://github.com/nebulousmango/The-Body-Metallic
Document references:
- Game design doc: link
Level maps
A bird's eye view of the entire level:
Contents of the scene:
- Player object
- Audio Manager
- UI
- Level:
- Floor cube
- Room one:
- Door + switch
- Walls
- Room two:
- Door + switch
- Walls
- Room three:
- Walls
- Invisible barriers
- Obstacle course
- Podium
Doors
For the doors, I use an empty parent object with the Door script attached to it. Its child is a cube object with the Animator component, which plays the door opening animation. The script for the switch calls this door script's Open Door function when the player interacts with the switch.
Switches
The switch is made up of a parent object that acts as a collider trigger, and a child cylinder object with an Animator component that plays the switch pressing animation. The parent object runs the Switch script, which has a variable in the inspector for a Door object and the interact overlay. The overlay is a UI plane that displays the press E to interact message when the player is near the switch. The door variable lets me set which door I want the switch to open. The parent object also has a collider that only lets the player interact with the switch if they're next to it.
Second room
The second room is a long corridor that the AI will chase the player through later. I stuck a few red arrows made out of cubes to the walls to make it easier for the player to find their way.
Third room
The third room's a long room with a string of obstacles and a victory podium at the end. The room's surrounded by an invisible barrier to prevent the player from jumping over the walls and into the empty space.
The obstacle course begins with a stretch of fire that the player can cross by navigating past a couple of moving platforms. The second obstacle is a column of pendulums, the third is a column of moving doors, and the fourth is a series of low hurdles. The fire, the pendulums, the moving walls and the hurdles are all fail state objects. The player will die and be sent to a fail menu if they come into contact with any of these objects.
Fail state
When the player dies, the camera snaps to the floor while the death animation plays, and the death overlay is active for five seconds before a retry menu is loaded. The death sequence is handled by a coroutine in the player's script. The Fail scripts runs this function if the player enters any fail state object's collider while alive.
Podium
The podium after the obstacles is a floating staircase that the player has to jump up to reach the victory point at the top. The player can interact with the vases at the top of the stairs to trigger the win scene.
Win state
At the top of the stairs is a clump of vases: the UI prompt press E to interact will activate if the player stands next to them. This is handled by the Win Trigger object, which is an invisible cube object with a collider trigger.
If the player presses E while inside the collider, they're taken to the win scene from which they can play again or go to the main menu.
Setting up the level
The floor is a 3D cube. It's set to a new layer called Floor, which the PlayerController script uses to check whether the player can jump or not (the player only jumps when in contact with the floor).
The Door object is also a 3D cube, but with an additional Animator component and a Door script. The cube has its own Animator Controller, which uses a trigger to run the animation for the door opening. The door stays open once the E key is pressed during a game.
The Door script runs the OpenDoor function when E is pressed. The function sets the Animator's trigger to true, and plays two audio files: a doorbell and a shutter door being opened. A bool in the script is used to make sure that the door can only be opened once in a new game.
Get The Body Metallic
The Body Metallic
Automaton troubles.
More posts
- 05 / Devlog, Sep 20 '23: enemy designSep 26, 2023
- 04 / Devlog, Sep 20 '23: player designSep 26, 2023
- 02 / ColophonJan 13, 2023
- 01 / Devlog, August 15 '21: bug fixesAug 14, 2021