Move Objects Around the Screen

The Interactive Way

It’s moving? Now let’s add some interactivity With user inputs. This section will teach you how to move objects in response to taps and finger movements on the screen.

A user input can take various forms: a single tap, a tap followed by a move, or a device movement like a shake.

Each time the user interacts With the device, an event is sent to your code. To react to this event, you need to “catch” it. We can catch an event by “listening” to it With an event listener.

Listen to a Tap Event

The simplest way to get user input is by listening to the tap event. A tap event is sent when the user “taps” an object on the screen. No more, no less. It’s great for “one shot” actions.

Here is a simple ...

Get Create 2D Mobile Games with Corona SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.