0 of 193 lessons complete (0%)
Exit Course
Scripting Part 3: Finishing the Game Loop

Set One of the Spots to Have Treasure

You don’t have access to this lesson
Please register or sign in to access the course content.

To test that this is working, we will pick a number, and test that we can set that dig spot to have treasure. We’ll start with the number 2, which is the maximum number if you have 3 dig spots (because array indices start at 0).

  1. In TreasureControllerScript, find the randomizeTreasure function.

After the console.log, send an event to digSpots[2] (the third dig spot), with “setHasTreasure” for the name of the function, and true for the value of its parameter.