Increase the Challenge
Tutorial
Beginner
20 Mins
Overview
Summary
You’ve started to design a level, but a puzzle made entirely of ramps is pretty boring. Now you’re ready to add in other objects to make things more challenging for the player.
In this tutorial, you’ll:
  • Add more objects to your puzzle
  • Add more marbles to your puzzle
Language
English
Recommended Unity Versions
2019.1
Tutorial
Increase the Challenge
1.
Add More Prefab Objects
Prefabs are a great way to standardize different objects in your game. The ramps that you used in the PuzzleLayout component are Prefabs. In this kit, we’ve also created Prefab objects which you can freely position to make your puzzle more challenging.
To add these Prefabs to your simple puzzle:
1. In the Project window, go to the file path Assets > Puzzle Creator Kit > Prefabs > PuzzlePieces. There are two subfolders which include objects which can be freely positioned: InteractivePuzzlePieces and OtherPuzzlePieces.
2. Open InteractivePuzzlePieces, then drag and drop the Prefab named Spoon into the Scene view.
3. Select the spoon in the Scene view and find its script component in the Inspector window. Script components are identified with a C# icon. All the InteractivePuzzlePieces have a script component which tells them how to move — the spoon’s is called Flipper.
4. Find the Interact Key field. All InteractivePuzzlePieces are activated when the player presses a key. The default option is the space bar, but you can change this using the drop-down menu.
5. Find the Power slider. This controls the power of the puzzle piece in the game. This has been set to a sensible default, but you can customize this for your puzzle.
All InteractivePuzzlePieces have a Power slider except the trapdoor, which has a slider called Open Speed.
You can add as many InteractivePuzzlePieces to your level as you like. Each has a sensible default power or open speed, but you can change this if you want to increase the challenge for players.
You can also add OtherPuzzlePieces using the same drag and drop process. These pieces don’t need any input from the player. Now try creating a new level (or two)! You can experiment with different ramp layouts and objects to create an increasingly challenging experience — for yourself and for players.

2.
Create Another Marble
You can also add multiple marbles to your levels to create more imaginative puzzles. If you add any additional marbles, it’s important to keep track of them carefully so that the game works properly.
First, let’s create a new marble:
1. In the Project Window, go to the file path Assets > Puzzle Creator Kit > Prefabs > OnePerLevel. 2. Drag and drop the Marble Prefab into the Scene view.

The new marble will appear in the Hierarchy window as Marble(1). You can right click on it to change the name to something more distinctive.

3.
Adjust the Camera Settings
To make sure that the Camera can follow different marbles in your level:
1. In the Hierarchy window, select the TargetGroup GameObject.
2. In the Inspector window, find the Cinemachine Target Group component for the GameObject.
3. Go to the Target list at the bottom of the component and click the + button. Then click the circular button to the right of the new item on the list and select the name of your new marble from the drop-down menu. 4. Use the double bars to the left of the list items to drag the marble which will move first to the top of the list.
5. Save your changes.

4.
Start the Level with a Different Marble
When you click Play, the initial marble in the level is frozen in space until the level has finished fading in, at which point the timer starts. If you want your new marble to be the one that starts the game, you need to adjust the Timing GameObject:
1. In the Hierarchy window, click the arrow to the left of the LevelUICanvas GameObject to see its child GameObjects. Select the Timing GameObject.
2. In the Inspector window, find the Timing Recording script component.
3. Click the circular button to the right of the Starting Marble field and select the name of your new marble.
TIP: You can also use the Timing Recording component to change the key used to restart the game, by selecting a new key in the Reset Key Code field. 4. Save your changes.

5.
Finish the Level with a Different Marble
If you want your new marble to be the one that triggers level completion, you also need to change the Goal settings:
1. In the Hierarchy window, select the Goal GameObject.
2. In the Inspector window, find the Trigger Target component.
3. Click the circular button to the right of the Marble field and select the name of your new marble from the drop-down menu. 4. Save your changes.

6.
Add Multiple Puzzle Layouts to your Level
If you want to really create a challenge, you can also add multiple puzzles to one level. This can be useful if you want to play with more advanced designs.
Note: As you’ve previously explored, only assigned marbles can start or end the level. If you are using multiple puzzle layouts in one level, check carefully to make sure you have assigned these roles correctly or you may have difficulty playing the level. To add multiple puzzle layouts to your level:
1. In the Hierarchy, select the LevelLayout GameObject.
2. Right-click on LevelLayout and select Duplicate.
3. Right-click on LevelLayout (1) and select Rename; give the new GameObject a more memorable name.
4. In the Inspector window, go to the PuzzleLayout component. You will be able to use this to build you ramp, just as you did for your first layout.
5. Select your new LevelLayout GameObject selected in the Hierarchy window. Move your cursor over the Scene view and press F to focus on the GameObject.
6. In the toolbar, select the Move Tool.
Use the colored arrows to move your new level layout GameObject, until you have placed it where you want to start building the second puzzle layout. 7. Save your changes. That’s it — you’re ready to build another puzzle layout! If you need a refresher on how to do this, you can return to the previous tutorial.