Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 3: Finishing the Game Loop

Use a Boolean Variable to Determine if the Spot Has Treasure

You don’t have access to this lesson

Please register or sign in to access the course content.

For the next phase of the game, we’ll make it so that you can have multiple dig spots, but only one has treasure. First, we’ll make it possible for a spot NOT to have treasure.

  1. In the DigSpotScript, create a new variable called hasTreasure and set it to false.
  2. Inside the if-statement that checks if the entity is a player, create another if statement that checks if the hasTreasure variable is true.
  3. Put all the code to send the event to the chest inside of this if statement, and indent it correctly.