Time for action - fix the graph

Did you fix the graph? We need to reset the position of the grapher-double sprite to the graph's origin when we click the flag:

  1. With the grapher-double sprite selected, add a when flag clicked block to the scripts area.
  2. Add the go to x: and y: block.
  3. Set the x value to -200 and the y value to -140.
  4. Add the clear block from the Pen palette to clear the lines that connects the dots when the flag is clicked.
    Time for action - fix the graph
  5. Click the flag and run the program by pressing the Space bar.
  6. Repeat as many times as you want with several different starting values.
Time for action - fix the graph

That looks a lot better. Now, let's review some of the important blocks that make our graph work.

Follow a sprite with the go to block

The go to block warrants some scrutiny. As we saw with our exercise, we can use the go to block to make one sprite go to the location of another sprite. What we do as the sprite moves is up to our imagination. For example, we could apply graphical effects; use the pen tool to draw a design, or any a number of things.

If we look at the drop-down list in the go to block, we'll note that all the sprites in our project are listed except the currently selected sprite. It doesn't make sense to direct a sprite to go to itself.

We can also set a sprite to go to the position of the mouse cursor, which means we could control the movement of a sprite on the stage by moving the mouse.

There are many sample Scratch projects that make a sprite chase after the mouse cursor.

Draw with the pen tool

By applying effects, such as size, color, and shading with the pen down block, we can trace a pattern with the sprite. When we want to stop tracing the sprite's movement, we use the pen up block. This is different from the stamp block, which creates an impression of the sprite at any given time.

The blocks in the pen palette provide a great way to draw dynamic patterns, such as a kaleidoscope, fireworks, line art, and many other imaginative objects.

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

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