In this tutorial we’ll enter the first level of the dungeon.
This tutorial is the start of the sub-series for setting up the dungeon.
Scenes are connected using Scene Changers and Spawn Points – the player enters a scene changer in a scene, the game loads the next scene and spawns the player at a spawn point.
We’ll connect the World scene to the first level of the dungeon to be able to enter and exit the dungeon.
Dungeon Entry #
We’ll start in the World scene (Assets/Scenes/), open it and navigate to the dungeon entry.
We’ve already added an Area, Music Player and a Save Point there.
Now, we’ll add a Spawn Point for returning from the dungeon and a Scene Changer to enter the dungeon.
Adding a Spawn Point #
Create a Spawn Point either using the scene hierarchy context menu (Makinom > Spawn Point) or the Makinom scene wizard (Create Game Object > Spawn Point).
The spawn point automatically receives the next unused Spawn ID, which should be 1, since we only have 1 spawn point in our town (which has spawn ID 0). When returning from the dungeon, the scene changer will use spawn ID 1 to place us at this new spawn point.
Transform #
We’ll adjust the rotation of the spawn point’s game object, as we’ll use it for the rotation of our spawning player.
- Rotation
Set to X=0, Y=90, Z=0.
Spawn Point #
And we’ll have to enable using the spawn point’s rotation when spawning the player.
- Use Rotation
Enable Y, disable X and Z.
Adding a Scene Changer #
Usually we’ll add scene changers like spawn points, i.e. using scene hierarchy context menu or scene wizard to create a new game object.
For our dungeon entry, there’s already most of the setup done for us, as there is already a collider used as trigger added to it.
All we need to do is add a Scene Changer component to the Dungeon Entry game object.
So, select the Dungeon Entry game object (i.e. the root of the dungeon entry) and use the component menu to add a Scene Changer component.
Scene Change Settings > Scene Settings > Target Scene 0 #
All we need to do is set which scene should be loaded by the scene changer.
- Target Scene
Set to Dungeon Level 1. - Position Type
Select Spawn ID. - Spawn ID
Select Value > Value. - Value (Spawn ID)
Set to 0.
This will be the spawn ID of the spawn point we’ll add to the dungeon level 1 scene.
The rest of the scene changer’s setup is arleady how we need it, using Trigger Enter to start the scene change.
That’s it for the World scene – don’t forget to save your changes.
Dungeon Exit #
Open the Dungeon Level 1 scene (Assets/Scenes/Dungeon/).
Adding a Game Starter #
Don’t forget that you need to add a Game Starter to a scene if you want to do a quick playtest right in the scene.
Create an ORK Game Starter either using the scene hierarchy context menu (ORK Framework > ORK Game Starter) or the Makinom scene wizard (Add ORK Game Starter > Add ORK Game Starter).
It doesn’t really matter where you place the game starter, but make sure to enable Start Game for quick game testing.
- Start Game
Enable this setting.
Adding a Spawn Point #
Again, create a Spawn Point either using the scene hierarchy context menu (Makinom > Spawn Point) or the Makinom scene wizard (Create Game Object > Spawn Point).
Place the spawn point in front of the stairs leading upwards – but not too close, as we’ll also add a scene changer to the stairs.
Like before, we’ll use the spawn point’s rotation for rotating the player.
Transform #
- Rotation
Set to X=0, Y=-90, Z=0.
Spawn Point #
- Use Rotation
Enable Y, disable X and Z.
Adding a Scene Changer #
Like with the dungeon entry, the staircase already has a collider used as trigger added to it, so we just need to add the Scene Changer component.
Select the Entrance_Staircase_Block game object – you can easily select it by clicking on the arch of the staircase.
The scene changer has to be added to the root game object (Entrance_Staircase_Block), not one of it’s child objects. Use the component menu to add a Scene Changer component.
Scene Change Settings > Scene Settings > Target Scene 0 #
All we need to do is set which scene should be loaded by the scene changer.
- Target Scene
Set to World. - Position Type
Select Spawn ID. - Spawn ID
Select Value > Value. - Value (Spawn ID)
Set to 1.
This was the spawn ID of the spawn point we added in front of the dungeon entry.
And that’s it for now – don’t forget to save your changes.
Testing #
Since we added a Game Starter to the scene, we can directly hit play in the Dungeon Level 1 scene and test our scene connection.
Run into the stairs and the World scene will load, spawning the player in front of the dungeon entry. Running back into the entry will load the Dungeon Level 1 scene again.
If you didn’t mute the audio, you’ll also hear the music change as it should.
However, you probably noticed the camera somewhat moving after loading the next scene – let’s fix that.
Camera Control Update #
Navigate to Base/Control > Game Controls and change the following setting.
ORK Control Settings > Camera Controls #
- Initial Damping
Disable this setting.
This’ll prevent the first camera change in a scene from using position damping, immediately setting it to the player’s position.
Testing, again #
Hit play, change scenes – no strange camera move, great!
Next, we’ll handle … the trapdoor!