In this screencast, you will use events to move the player 1 spritewhen the arrow keys are pressed. To start,click on the player 1 sprite. In this game, the user needs to be able to move the sprite:To find blocks that move the spriteclick on motion. If you’re not sure which blocks to choose,double click on a few to see what they do. For example, if you double click on “move10 steps,” you see that it moves the sprite forward, so you can choose to add it to the program.
Double clicking on the “turn” blocks the sprite,so drag both of those out as well.
You now have three blocks in your program,but the only way to run them is to click on them. That doesn’t make for a very exciting game.
To fix this, use event blocks to run this code when the user presses the arrow keys.
Click on the events menu. Event blocks tellthe computer when to run code. You could use an event block that would run code “when”the green flag is clicked, or “when” the sprite is clicked. But, for this game, youwill use a “when” key pressed block.
This block has a drop down menu that shows all key press options. The sprite shouldmove forward when you press the up arrow, so select “up arrow” and attach this blockto the “move 10 steps” block.
Try this by pressing the up arrow. Great!
Now, this sprite moves forward when the up arrow is pressed.
You can add more keypress events to turn this sprite clockwise with the right arrow, andcounterclockwise with the left arrow.
Great! Now I have a basic racing game and it's your turn to create your own.
Once this screencast is finished, program the player 1 sprite using:1) A keypress event for up, left, and right arrow keys2) A movement block for each eventRemember, if you have a question, you can ask a neighbor or use a sticky note to getthe attention of your CS First Guru.
After you have completed this step, go to the next screencast by pressing the green arrow.