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

Using swipes

If you use a mobile device, such as a phone or tablet, it's a safe bet to use swipe controls in a game or an app; popular games such as Fruit Ninja have been designed entirely around this type of a touchscreen input. Swipe controls are intuitive for certain onscreen actions (such as slicing a fruit), so the game just feels right; it's satisfying. Let's take a moment to cook up some satisfying controls.

Getting ready

We'll create a simple demo to showcase the swipe movement. To do this, you'll need a simple room and two objects. The first object should be called obj_target and requires a sprite; I chose a simple green box. The second should be called obj_control_swipe and requires no sprite. Based on the name, I'm sure you can guess ...

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