You now have the sprite dancing in one place
but people and characters usually move around
when they dance.
In this video you will make the sprite
move around the stage
using the glide block.
Click on the motion menu
to see all of the blocks that can be used
to change the sprite's position on stage.
For this dance use the glide one second block.
In this example, watch what happens
when you drag the glide block
into the script editor.
If you move the sprite somewhere on the screen
then click the glide block,
the sprite would go back to the position
it was in when the block was first dragged out.
If the code is not running you can see
that the glide block in the script builder
says glide one second to X negative three
and Y positive 16.
Those X and Y values represent Cassie's position
on the stage.
If you move Cassie you will see that
the X and Y values change
to show Cassie's new position on the stage.
To make the sprite move back and forth
as it dances,
put the sprite in one spot on the stage
then drag out the glide block
for that position.
Next move the sprite
to a second position on the stage
and drag out another glide block.
Try these two positions
by clicking one glide block
and watching the sprite move to the new spot
then clicking the other glide block
to see her move slowly to the second spot.
You can even reduce the value
in the seconds field
to make her move faster.
Once you're happy with the sprite's movement
place these two blocks
inside the forever loop
with some next costume blocks in between.
Now the sprite both dances and moves.
Finally, click on the events menu
and add a when flag clicked block
to the top of the block stack.
Doing this will make your project start
when the flag is clicked.
In computer science it often takes
more than one try
to find the right solution to a problem.
If you get stuck feel free
to ask your neighbor for help.
Now it's your turn.
Drag the sprite to a position on the screen
where you want it to dance,
then drag out the glide one second block,
which will contain X and Y coordinates.
Move the sprite to a new position,
then add another glide one second block.
Add both blocks to your code stack
and see if you like the dance.
Remember, you can always try different values
in the white fields
until you create a dance that you like.
Sign in to track your progress and earn badges