We will continue working with our script from the previous example:
We added the change x by block to our script to make the cat move horizontally toward the right side of the stage. As we increased the value, our sprite moved further across the stage each time.
Next, we added the change y by block and gave it a negative value. When we clicked the flag, the sprite continued to move horizontally to the right, but it also moved down.
Scratch uses an X and Y axis to divide the screen into quadrants. Enter a positive number for X, and the sprite moves to the right. Similarly, enter a negative number for X, and the sprite moves to the left, or backward. A positive Y value makes the sprite climb, while a negative Y value makes the sprite fall.
The unit of measure on our coordinate system is pixels. Each sprite on the stage has an X and Y coordinate that allows you to locate it, but it also allows you to send a sprite to a specific coordinate.
As we'll discover later, even the mouse pointer has an X and Y coordinate that allows us to precisely locate the pointer.
So far we've seen two ways to control the sprite on the stage. We can build a script that uses a control block, such as the flag. Or we can double-click on a block or set of blocks to run a command on the sprite.
The ability to run an individual block against a sprite gives us a chance to observe the behavior of the block before we add the block to our script. It's a great way to test and learn.
Double-clicking on a block works if we have one, ten, or an infinite number of blocks stacked together.
18.225.35.81