Simple User Input

Topic

Simple User Input

Topic Progress:

When you make a game you need a way to interact with the program such as using keys on a keyboard or a mouse.

To get the sprite to respond to different keys being pressed click on the Events tab on the left side of the screen and drag out a block that says when space key pressed.

You can then click the box inside that currently says space and change this to any key on a keyboard.

Any code underneath this block will run whenever that key is pressed.

For example, this code https://scratch.mit.edu/projects/346221486/editor/ will make the cat say hello whenever the up arrow key is pressed.

Have a go with this and try getting the sprite to do different things when different keys are pressed.

Course Discussion

@

Not recently active