Today we will learn how to use buttons to control the way the Sprite moves.
Button Control Blocks
So far we have given our Scratch programs instructions to follow step-by-step. For our next program, we will be creating a Scratch Project that will react to what we do, rather than go through steps in order. The first thing we will do is make a way for the user to be able to control the Sprites movements with the keyboard.
In the Control Menu, we see a block that says "When Space is Pressed". That is the block that tells the Sprite to react to keyboard buttons. The Space button can be changed to any button you want.
We are going to use buttons to make our sprite move. We can use "change x by" and "change y by", combined with the "When Pressed" block to do this.
We will make 3 seperate blocks of code. One for moving left, one for moving right, and one for jumping. All of these movements should be controlled by the keyboard.
Use the costumes to make it look like the Sprite's feet are moving when it moves.
Back to School Portal