In this video, you'll make the ball sprite
bounce around the screen.
There are a lot of blocks in the motion menu,
and Scratch, that make the sprite move in different ways.
The simplest way for a sprite to move is
in the direction it's already facing.
Click on the ball sprite.
From the motion menu, drag out the move block, click on it.
The sprite moves, but only once, it needs to keep moving.
In Activity Two, you used a repeat block to make the sprites
repeat their change costume action,
but that made the action happen
a specific number of times, then stop.
In this project, the ball should keep moving.
From the control menu, place the forever block
around the move block, click this stack and test it.
The ball sprite moves until it hits an edge.
Computer Scientists call problems on their code bugs,
but if on edge bounce block from the motion menu
will fix this bug so the ball can keep moving.
If you click on it, it seems to do nothing,
but when you place it inside the forever loop,
the ball sprite starts bouncing
around the stage, pretty sweet.
Right now, the ball will start moving
in a predictable direction, which makes the game easier.
To make the ball start moving in a random direction,
from the motion menu, place a point in direction block
on top of the forever loop.
To make it choose a random direction,
from the operators menu; place a pick random block
inside the point in direction block.
Tinker with the numbers in the pick random block
until you find the ones you like.
This example uses -45 and 45.
Finally, make the ball sprite start moving
when the flag is clicked.
Place a when flag click block at the top of the block stack.
Click the flag, the ball sprite will start moving.
Alright, heres the game plan:
make the sprite move with the move block,
make it move forever with the forever block,
and bounce with the if on edge bounce block.
Make the balls start moving in a random direction using
point in direction and pick random, and finally,
add a when flag click block to the top.
After the ball sprite is bouncing around the stage,
move onto the next video
to get the athlete sprite into the action.
Sign in to track your progress and earn badges