/** Ninjas practice using the spin function on three different objects. New Vocabulary and Concepts * Logs and Errors Reinforced Vocabulary and Concepts * Functions and Parameters * GDP spin() function * Object Names Sensei Notes * The Ninjas will not add any objects to the scene. * This activity introduces an error on purpose to stress the importance of GDP object names. The Debug tab is not a focus of the White Belt. Solution Steps 1 Make sure the Ninja opens the correct scene. 2 Make sure the Ninja is on the correct object and in the correct event. 3 This piece of code is the same as the first piece of code in the previous activity. The Ninjas need to realize that the GDP acts on objects with specific names. There is not an object named "star' in this scene, so the GDP does not know what to do. spin(star, 10); 4 No stars should be spinning. You can ask the Ninja what they think is wrong, but they should not know why at this point. 5 This is could be the Ninja's first scene that is "broken," so stress that debugging is part of programming. There is no "right" or "wrong" answer or way to program. The Error in the console should be "ReferenceError: star is not defined." 6 Explain that each object has a unique name and that the names of the three stars in this scene are yellowStar, orangeStar, and greenStar. 7 Have the ninja change only the first parameter from star to yellowStar. When the Ninja plays the game, only the yellow star should be spinning. 8 This is the first time that the Ninja is adding more than one line of code. Make sure they understand the enter key moves to the next line. When the Ninja plays, the yellow and orange stars should be spinning at the same exact rate. 9 This is the first time Ninjas are expected to produce their own line of code from nothing. If they struggle, help them use the existing two lines as a model for the new line. The first parameter should now be greenStar. 10 Before the Ninja submits their game, make sure they understand the purpose of functions. We can ask the GDP to perform actions on objects. While pieces of functions might change, they always have a name, parentheses, and zero or more parameters. */ spin(yellowStar, 10); spin(orangeStar, 10); spin(greenStar, 10); /** Sensei Stops 5 Tell a Sensei what you think this error means. What does it mean when it says, "star is not defined?" Ask the Ninja what "star" is in this context. Remind them that it was referring to an object in the scene. Ask the Ninja what happens if you call them by the wrong name? Would they respond? Of course not! That must mean that we don't have the correct name of any of the stars. 10 Tell a Sensei about line 3 of your code. How did you know what name to use? What are the components of a function? It is important to understand the thought process of the Ninja. They came up with the code on their own, so ask how they knew what to type. See if they remember the definitions of function and parameter. See if they remember the parameters of the spin function. */