6. Wrap-up: A Racing Game
In this activity, you learned to use an important computer science and gaming concept: events.
Events are actions that tell the computer to wait for a response. In the game you created today, you used keypress events to allow a user to move sprites.
Events are used in computers all around you and in some places you might find surprising!
Take a look at how events are used to program a smartphone or tablet.
Any time the user touches the screen, an event is triggered. For example, to send a message to a friend, the user types using the keyboard on the screen, just like you see here. The computer scientist programmed the app to type out an “a” when the “a” key is touched, a “b” when the “b” key is touched, and so on.
Gestures, such as swiping and pinching, are also events. For example, in the Google Maps app, the map moves to the left when you swipe to the left, and it zooms out when a user pinches the screen. Tapping and swiping aren’t the only types events these devices use. There are also events for tilting, shaking, and even talking! Smartphones and tablets could not be programmed without events.
Next session, you will build on the computer science knowledge you gained today by programming a maze game. In this game, you will need to move a character from start to finish without touching any maze walls. This game will introduce if statements, which allow you to program computers to make decisions.
Until next time-- have fun creating and coding. See ya next time!