Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you will program your sprite
to move, bounce off the edges of the stage
and point towards the mouse pointer.
Your starter project begins with the sprite, Tera.
To make Tera move, select the Motion menu
and pull out the Move 10 Steps block.
Clicking it, will make the sprite move 10 steps.
Tinker with the value to make the sprite move
a little or a lot.
Notice that if the value is negative,
the sprite moves in reverse.
Right now, the sprite only moves 10 steps,
once, when you click the block.
But for this project, Tera should move constantly.
Go to the Control menu and pull out a Forever loop.
Place it around the Move block.
Now, when you click the block stack, Tera should
constantly move until it moves off screen.
Using only the Forever loop and the Move block,
Tera is not programmed to either stop or turn around.
To make Tera turn around,
when reaching the end of the stage,
place an If on Edge Bounce block inside the Forever loop.
When you test it, the sprite should bounce back and forth,
across the screen.
That is a great effect but Tera also needs to be able to
change direction and follow the mouse pointer.
Fortunately, there's a block for that.
From the Motion menu, pull out
the Point Towards Mouse Pointer block
and add it to the stack.
Now, when you test your program, Tera should always move
towards the mouse pointer but never move off screen.
Now it's your turn.
Use the Motion and Control blocks to make Tera always move
but never move off screen.
Make Tera follow the mouse by using
the Point Toward Mouse Pointer block.