Time for action set the graph’s origin

We want our graph to display in the same spot on the stage each time; therefore, we'll use the flag to reset the double sprite's location on the stage:

  1. From the Motion palette, add the go to x and y block to the end of the existing when flag clicked script. Enter -200 for the x value and -140 for the y value.
  2. When we reset the sprite's coordinates, we also want to clear any graphs we may have drawn. From the Pen palette, add the clear block.
  3. Click the flag to position the double sprite to the bottom-left corner of the stage.
Time for action set the graph’s origindouble it calculationvalues, graphing

What just happened?

By now, you should be able to tell me what just happened with the blocks we added. This code was relatively simple. We sent our sprites to a specific starting point on the stage when the flag was clicked.

The clear block is new and will clear any graphs we draw with the pen tool. We'll cover the pen tool in the next exercise.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.85.142