Page 105 - 2502_Pakistan-kifayat_C-7
P. 105
EVENT
In Scratch, events are the blocks that trigger actions in your program. They are the starting point of
any action or script in a Scratch project. These event blocks listen for specific triggers (like when a key
is pressed, when the green flag is clicked, or when a sprite is clicked) and then start the sequence of
actions you want to happen.
To move a sprite in Scratch, you can combine event blocks with motion blocks.
Some key event blocks used to move a sprite are as follows:
1. When Green Flag Clicked: This is the most common event used in Scratch. When
you click the green flag, the script associated with this event is triggered, starting
the program.
2. When [key] Pressed: This event triggers actions when a specific key on
the keyboard is pressed. You can choose keys like the spacebar, arrow
keys, or letters.
3. When This Sprite Clicked: This event triggers actions when the user clicks
on the sprite.
COORDINATES
In Scratch, coordinates are used to define the position of sprites on the stage. The stage is a grid where
the x-axis runs left to right, and the y-axis runs up and down. The (0,0) coordinate is at the center of
the stage, with positive x values to the right and positive y values upwards.
Some key coordinates blocks used for moving a sprite:
1. Go to x: [ ] y: [ ]: This block moves a sprite to a specific coordinate on the stage. You can set the x and
y values to any number to position the sprite.
x: Horizontal position (left-right).
y: Vertical position (up-down).
2. Change x by [ ]: This block changes the sprite’s position along the x-axis. A
positive value moves the sprite to the right, and a negative value moves it to
the left.
3. Change y by [ ]: This block changes the sprite’s position along the y-axis. A
positive value moves the sprite up, and a negative value moves it down.
4. Glide [ ] secs to x: [ ] y: [ ]: This block makes the sprite glide
smoothly to a new position over a specified time. It moves the
sprite to the given x and y coordinates.
5. Set x to [ ]: This block sets the sprite’s x-coordinate to a specific value, overriding
its current position.
6. Set y to [ ]: This block sets the sprite’s y-coordinate to a specific value, overriding
its current position.
#More on Scratch 103

