Book Image

GameMaker Cookbook

Book Image

GameMaker Cookbook

Overview of this book

GameMaker: Studio started off as a tool capable of creating simple games using a drag-and-drop interface. Since then, it has grown to become a powerful instrument to make release-ready games for PC, Mac, mobile devices, and even current-gen consoles. GameMaker is designed to allow its users to develop games without having to learn any of the complex programming languages such as C++ or Java. It also allows redistribution across multiple platforms. This book teaches you to harness GameMaker: Studio’s full potential and take your game development to new heights. It begins by covering the basics and lays a solid foundation for advanced GameMaker concepts. Moving on, it covers topics such as controls, physics, and advanced movement, employing a strategic approach to the learning curve. The book concludes by providing insights into complex concepts such as the GUI, menus, save system, lighting, particles, and VFX. By the end of the book, you will be able to design games using GameMaker: Studio and implement the same techniques in other games you intend to design.
Table of Contents (17 chapters)
GameMaker Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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] = 60;
  2. Next, add an event to Alarm0 using the following code:

    instance_create((random_range(0,room_width)),(random_range(0,room_height)),obj_balloon);
  3. In obj_balloon, simply add a mouse left pressed event and enter this code into a code block:

    instance_destroy...