Step 5: Initializing the Animation Variable

Goal:


Let’s set up the new variable at the beginning of the game so that our animation variable will reset every time the game starts.

Steps:

  1. Still on the “Sharky” sprite, add the following code.
  2. From Events, place a when green flag clicked block.
  3. From Variables place a set to block.
  4. Change the block to sadAnimationTime and set the number to 0.

Code: