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

Adding tap control

If there's one thing mobile games and apps tell you to do, it's to tap something. Tap to start. Tap to continue. Tap to win! Okay, this one may be less common, but the point remains the same. Tap controls are the most common control styles in mobile games and the best part is they're not hard to code. Let's take a look at an example right now.

Getting ready

For this recipe, you'll need two objects. Give one object a simple sprite (such as a blue circle) and name it obj_balloon and name the other obj_control but don't assign a sprite to it. Make sure obj_control is placed inside the room you're using for this recipe.

How to do it...

  1. In the control object, add a Create event to a code block that sets the following alarm:
    alarm[0] = ...

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