Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 2: Making Code Respond to Players

Make a Function to Start the Chest Lid Opening Animation

You don’t have access to this lesson

Please register or sign in to access the course content.

Now that we have created and tested the startAnimation and stopAnimation variables, we want to change their values with code, and not through the entity menu. To do this, we’ll make both variables private, then create a function to set startAnimation to true and stopAnimation to false.

  1. Use the keyword private to make the startAnimation and stopAnimation variables private.
  2. Below the tick function, create a new function called startOpeningLidAnimation
  3. Inside this function, set this.startAnimation to true and set this.stopAnimation to false.