Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 2: Making Code Respond to Players

Make a Boolean Variable to Track Whether the Chest is Open

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

In the next steps, we’ll add code to close the chest lid again. In order to do that, we need a variable that keeps track of whether the chest is currently open.

  1. Above the start function, create a new private variable named isOpen.
  2. Set it to false initially.
  3. In the openChest function, set it to true in the else-statement after the animation finishes.