O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

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

Moving characters or objects by tilting a device

Another widely used feature in smartphones and tablets is the built-in gyroscope. This component allows basic motion controls that are read by their movement. The most common use of device tilt is to control the screen's visual orientation, but it can also be used for games. We're going to take a look at how to use tilt controls to move an object around.

Getting ready

Before we begin, you'll need to set up your room for a mobile device. As we'll test tilt functions that utilize an accelerometer, this recipe can only be tested on a mobile device, such as a smartphone or tablet. With the purchase of a GameMaker Professional license, you can test them on Android devices without purchasing the exporter. ...

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