To create many interactive computer applications, you need the ability to detect when certain things are happening. For example, in a car racing game, it would be important to be able to detect when two cars (sprites) bump into one another, and in a game that uses predefined keystrokes as input for controlling certain game functions, you need to be able to detect when those keys have been pressed. Scratch provides the ability to detect or sense when things happen using sensing code blocks. This chapter will demonstrate how to work with various sensing blocks and will also guide you through the creation of a new Scratch application, the Family Scrapbook.
The major topics covered in this chapter include learning how to
Detect mouse-pointer location and mouse button status
Detect when keyboard keys are pressed
Determine when a sprite collides with other objects on the stage
Keep track of a sprite’s distance from other objects and retrieve different sprite properties
Work with a timer and detect the loudness of microphone input
3.139.103.204