Welcome to the second tutorial in the Obstacle Game Miniseries. This is a continuation from Obstacle Game Miniseries #1, which introduces this series and guides you through building an intriguing entrance to the level.
In this tutorial you will:
- Add a locked door which can be opened by jumping on a floor switch
- Create automatic doors
Adding A Locked Hatch
The Player is on the roof, which means we can make them take an exciting drop into a new area. The obstacles in this section will use the same tools used to open doors explored in Basic Tutorial 2: Events, but in a slightly different way.
To start with, add a turn to your roof, and use the turn as an opportunity to increase the difficulty from Very Easy to Easy – the new pathway should be 6 – 10 Voxels wide.
It’s good to have areas of your level that are not too demanding. The blank space gives the player a chance to recover after a difficult challenge, and you can always add interesting visual elements when you come to dress the level later on.
Now it’s time to add a loft hatch. To do this, you will be repurposing the LockedDoor Script from the Super Smash ‘n’ Grab Package. Open the Library and enter the Community tab.
Install the SuperSmashNGrab Package.
Return to the Library and open the Props tab. Add the Vault Door to your Hotbar.
Close the Library.
Place the Vault Door Prop at the end of your rooftop pathway.
Open the Entity Editor for the Vault Door and move and rotate it so that it is lying flat attached to the end of the roof.
Use the Voxel tools to build a setting around it.
Continue your narrow rooftop path past the Vault Door. The Player will solve this puzzle by doubling back on themselves.
Creative Control: Your own path
Whilst this tutorial guides you through making a basic level structure, the details of the level are entirely up to you. You can copy this exactly, or you can make yours more or less difficult by creating more difficult pathways to navigate.
Open the Library and navigate to the Props tab. Add the Pad (Pressure) Prop to your Hotbar.
Close the Library and add the Pad (Pressure) to the end of the narrow pathway.
Open the Entity Editor for the Pad (Pressure) to fine-tune it’s position.
Position it slightly below floor level. This way the Player will run onto it seamlessly.
Adding the Pad (Pressure) at the end of this rooftop will give us a great opportunity to create a spectacular view later on!
As you did with the Vault Door, use the Voxel tools to build around it, embedding it within the roof.
That’s the positioning taken care of, now to add the functionality.
Open the Entity Editor for the Vault Door.
Select “Add to Entity”.
Select Add > Script > LockedDoor.
You can add Sounds to this later, but for now leave the LockedDoor Script Properties blank.
Close the Entity Editor for the Vault Door and open the Entity Editor for the Pad (Pressure).
Click the “+” icon next to the onCollision Property.
Click the arrow and add the bankVaultDoor as the Entity – use the menu to find it within the terrain object.
The Script should be automatically set to the LockedDoor Script attached to the Vault Door when you select the bankVaultDoor Entity.
Select the OpenDoor() function as the Event.
Close the Entity Editor and test the functionality by Previewing the game.
You should find that when you jump on the Pad (Pressure) the door opens. If it doesn’t open, make sure that you are jumping on the pad (it takes a bit of force to run the onCollision event for the Pad (Pressure)) and then double check that you have hooked up the Properties the same as above.
Stop the Preview and return to the Editor mode.
Now to add some drama to your game by building a shaft below the Vault Door so that when the player enters it they will freefall.
Tech Tip: DeathZ
Before we give the Player a drop to the next section, it is worth highlighting a technical aspect of game development – the deathZ (also called a death plane)!
By default, the DeathZ Game Property is set to -1000. This means that if your Player’s Z-Position gets to -1000 then they will die, and they will respawn at the start. If deathZ didn’t exist, the Player would fall forever, and Crayta would be full of Players stuck infinitely falling to their deaths!
This Property is possible to edit in Advanced Mode (if that is accessible to you). If you don’t have access to Advanced Mode, make sure that your terrain does not go below -1000 on the Z-Axis. You may need to check your shaft to ensure the Player isn’t killed by jumping in!
If you can’t (or don’t want to) enter Advanced Mode, select the terrain Entity and move the whole terrain up, including the Players spawn Locator which you can find where the Player is spawned currently.
To build the shaft, position your Drone view underneath the Vault Door. Use the Voxel tools to build 1 Voxel wide wall around the edge of your Vault Door.
Use the Extrude tool to extend the shaft down.
At the bottom, continue three sides of your shaft to create an opening.
Add a floor to the bottom of the shaft.
Extend the floor beyond the shaft to create a pathway out of the shaft.
Adding Automatic Doors
Open the Library and navigate to the Props tab. Add the Office Door Prop to your Hotbar.
Close the Library.
Add the Office Door to the exit of the shaft.
Use the Voxel tools to build a corridor around the door.
This door marks the entry to a new area of the map, and will give some context to Checkpoint2. You will use a trigger and the LockedDoor script to make this door open automatically when the player gets near it.
Open the Library and navigate to the Primitives tab.
Add the Trigger to your Hotbar.
Add a Trigger just in front of the door.
Open the Entity Editor for the Trigger.
Change the size of the Trigger so that it is the entire area behind the door.
Open the Entity Editor for the Office Door and add the LockedDoor Script.
And now open the Entity Editor for the Trigger once again. Click on the “+” next to onTriggerEnter.
Select the Office Door Entity and the OpenDoor() function of the LockedDoor Script.
Finally you need to add Checkpoint2 to the other side of this door. Use the Voxel tools to extend the floor.
Make sure you have the Select tool enabled (press B if you still have Voxel tools). Fly your drone to find Checkpoint2 from the original level.
Press RT to pick up the Checkpoint2 (make sure to select the Checkpoint and not an individual aspect of it – again use the tool descriptions in the bottom left to check before you press RT).
Move it to the pathway on the other side of the Office Door.
Use the Entity Editor to fine-tune the position of the Checkpoint2 (remember the grid is based on multiples of 25.000).
Preview your game and test your new obstacles.
Next Steps: Obstacle #3
Success! You have just added two new doors to your game. Now that you have presented your Player with a simple challenge you can start to ramp up the difficulty and move on to creating some more difficult obstacles.