5. Detecting When the Puzzle Is Solved
5. Detecting When the Puzzle Is Solved
By completing this step in the Tagged Lights Puzzle tutorial, you'll learn how to detect when the player solves the puzzle so you can spawn an item and prevent further interaction with the puzzle
By completing this step in the Tagged Lights Puzzle tutorial, you'll learn how to detect when the player solves the puzzle so you can spawn an item and prevent further interaction with the puzzle
Detecting a Solved Puzzle
This section shows how to detect when the player solves the puzzle by finding the right combination of lights. When the puzzle is solved, the Item Spawner device should be enabled so that it can spawn its item.
Follow these steps to detect when the player solves the puzzle:
- Add an editable
item_spawner_devicefield namedItemSpawnerto thetagged_lights_puzzleclass, to represent the Item Spawner device.| | @editable | | --- | --- | | | ItemSpawner : item_spawner_device = item_spawner_device{} | Copy full snippet - Next, define what state the lights should be in to solve the puzzle. Since the representation of the lights’ state is a
logicarray, the solved state of the lights should also be alogicarray to easily compare the two. Create an editablelogicarray field namedSolvedLightsStateto thetagged_lights_puzzleclass. In this example, the player must turn on all the lights to solve the puzzle, so initialize each element with the valuetrueto represent the light being on.
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.