Escape Room

Game Development Tutorial

I – Choosing Scene and Environment

The first thing we need to do after making a new project is to make a scene. The main scene will be called “EscapeRoom” and the second one will be “Maze”.

For the main scene, we are going to choose the Clinic environment and the second scene will have the Natural#4 environment.

II – Adding Components to the Scene

For the escape room scene, we will add:

  1. 4 Trigger boxes (One on each corner of the room).
  2. 4 items in each corner: Heart, Knife, Remote and Map.
  3. Table and put on it a computer screen, keyboard and a mouse.
  4. Input field and re-size it to fit in the computer screen in step 3.
  5. The characters: K 1 0 1 5 H and re-position them to be in the upper center of the player’s camera (when pressing play).
  6. Add a Coin Sound Effect to any character.
  7. Two timer Texts: One to Display “Timer :” and the other to be the counter, and re-position them to be under the characters in step 5.
  8. 4 Text fields to display messages to the player while playing.
  9. A “Game Over” Text with red color and attach a lose sound effect.

For the Maze scene, we will add:

  1. Green cubes all over the map to make the maze.
  2. Trigger Boxes in each intersection.
  3. Trigger Box and a Treasure Object in the end of the path.
  4. Attach a winning sound effect to the Treasure Object.
  5. Right and Left arrows on the wall in each intersection.
  6. Step 7 and 9 from the previous part.
  7. A “You Win!” Text with Gold color.

III – Pickups and Trigger Boxes

There are 4 Trigger Boxes, 3 Pick Ups and 1 Popup Question (Fig.1.1 and Fig.1.2). On Entering each Trigger box, the corresponding Pickup character is taken and a UI element of it is shown. This code is controlled in the camera as shown in Fig.2

For the Pickups:

  1. Put Enter Trigger Box block and select its name.
  2. Add Get GameObject and select the character object to be shown.
  3. Add Enable GameObject.
  4. Step 2 again and add Play Sound.
  5. Repeat step 2 and 3 for the corresponding Text.
  6. Add Wait block and write “4” seconds.
  7. Repeat step 2 for the Text.
  8. Add Disable GameObject.

For the Popup Question:

  1. Put Enter Trigger Box block and select its name.
  2. Add the Create Multiple Choice block.
  3. Repeat step 2, 3 and 4 in pickups.
Fig. 1.1

Fig. 1.2
Fig. 2

II – UI Elements

The UI elements are all children of the camera. In the beginning, all UI elements are disabled, except the Timer that works with a for loop and a down counter block as in Fig.3 and the game tip text that disappears after 4 seconds Fig. 4. On entering each trigger box a tip appears for 3 seconds to explain the pickup and the character you found that will be enabled upwards. Finally, the “Game Over” text appears after the Timer reaches zero.

For the Timer: (in the camera’s code)

  1. Put OnStart block.
  2. Add the For Loop with Down Counter blocks.
  3. In the loop body Change Text of the timer text to the value of the current loop counter then Wait 1 second.
  4. In the loop done Change Text of the timer text to Zero the Enable the Game Over Text and Play Sound.
Fig. 3
Fig. 4

III – Changing Scene

In order to change the scene, you will have to collect all keys to know the password and enter it on the input field in the computer screen (Fig.5). As in the input field’s code in Fig.6. If it is correct you will go to the next level else, an “incorrect password” message will be displayed.

For the Password: (in the input field’s code)

  1. Put When Button Is Pressed block and add the “Enter” Key.
  2. Add Get Input Text String then Compare Strings with the String “k45h” (the password).
  3. Add A Branch.
  4. If the password is Correct then GoTo Scene “Maze” else print String “Incorrect Password”.
Fig. 5
Fig. 6

III –Maze Scene

The second scene is a maze (Fig.7) that have similar UI elements (Timer and Game Over) as the previous one, except that in this scene on entering a trigger box a question will appear if your answer is correct, the white arrow will change its color to indicate the right way(Fig.8). This code is attached to the camera (Fig.9).

Fig. 7
Fig. 8
Fig. 9