O'Reilly logo

Scratch Cookbook by Brandon Milonovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keyboard input to a program

There are many cases where you may want to get your user to input some text or numbers into a program you are creating. For instance, you may want to get your program to get a value to change something from the user. You may also be playing a game and need input from the user to answer a question.

In this recipe, we'll explore how we can use a Sensing block that will accomplish all of this for us.

Getting ready

To prepare, let's create a new program. We'll create a program that creates a bit of user interaction and incorporates some of what we've learned already. Import a sprite of your choice, as well as a background of your choice, before we get going.

Note

We are using Tera (from Fantasy) as our sprite with bedroom2 (from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required