Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 2: Making Code Respond to Players

Stop the Animation Code

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

To keep from doing unnecessary work (and to make it possible to restart later), we need to create another boolean variable that keeps track of whether the animation should stop.

  1. Create a new variable called stopAnimation and set it to false.
  2. Use && in the if statement to make it check that startAnimation is true AND that stopAnimation is NOT true. The ! character means “not”.