You are on page 1of 134

Using GameMaker:Studio

Pgina 1 de 134

Using GameMaker:Studio
GameMaker:Studio is an easy to use program for creating your own computer games.
GameMaker:Studio has two initial export options (three if you bought GameMaker:Studio through Steam) that permit you to create full games for Windows and Mac OS, but you can also get additional modules which will permit you to export to additional platforms like HTML5, Android, iOS and Windows Phone. The HTML5 module enables you to produce ready-to-run HTML and JavaScript code that you can host or embed on any website, the Android module enables you to create and distribute *.apk files and if you have iOS developer account you can also publish to iPad, iPhone and iPod with the iOS module. These modules are available only to those who have upgraded from the Free or Standard version of GameMaker:Studio to the Professional version (more information on the different versions can be found here). This section of the help file gives you all the information you need for creating your first games. Later sections will discuss more advanced topics, how to polish and distribute your game, and the built-in programming language GML that considerably extends the possibilities of the product. Information on the basic use of GameMaker:Studio can be found in the following sections: 1. 2. 3. 4. 5. Introduction Installation and System Requirements Activation GameMaker:Studio Overview The Graphical User Interface (GUI) 1. - The File Menu 2. - The Edit Menu 3. - The Resources Menu 4. - The Scripts Menu 5. - The Run Menu 6. - The Window Menu 7. - The Help Menu Loading Sprites Sounds And Music Backgrounds Defining Objects Events 1. - Create Event

6. 7. 8. 9. 10.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 2 de 134

11.

12.

13. 14.

2. - Destroy Event 3. - Alarm Events 4. - Step Events 5. - Collision Event 6. - Keyboard Events 7. - Other Events 8. - Draw Event 9. - Asynchronous Events Actions 1. - Move Actions 2. - Main Actions, Set 1 3. - Main Actions, Set 2 4. - Control Actions 5. - Score Actions 6. - Extra Actions 7. - Draw Actions 8. - Using Variables and Expressions in Actions Creating Rooms 1. - Settings 2. - Backgrounds 3. - Objects Game Information Distributing Your Game Next: Advanced Use

Back: Contents Copyright YoYo Games Ltd. 2013 All Rights Reserved

Introduction
An introduction to GameMaker:Studio.
We all know that playing computer games is fun. But what many people don't realise is that it is actually more fun to design your own computer games and let other people play them! Now, making computer games is not normally a simple thing and the commercial games you buy nowadays typically take two or three years of development with teams of anywhere between 10 and 50 people and budgets that can easily reach millions of dollars. Not to mention the fact that all these people are highly experienced: programmers, art designers, sound technicians, etc.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 3 de 134

But that's changed with the advent of GameMaker:Studio. With GameMaker:Studio you can start to prototype and create your own computer games quickly and easily without the absolute need to learn a programming language. GameMaker:Studio offers an intuitive and easy to use Drag-and-Drop (referred to as 'DnD' from now on) interface of action icons that allow you to start on creating your own games very quickly. You can import and create images and sounds to use in objects, and then instantly see the results of your actions at the press of a button. Obviously, you want to get started as quickly as possible, so GameMaker:Studio is bundled with a considerable collection of sprites, backgrounds and sounds which you can import and use to get straight to work. These sprites are designed as "place holders" to get you going but they are not for use in any finished product. It should be noted here that GameMaker:Studio focuses on two-dimensional games, (which isn't to say that it's not capable of 3D, as it is!) and many great games use 2D sprite technology, even though they look very 3D when playing. As mentioned previously, you need to assign images (sprites) and other things to objects, which are easily defined in your game through the DnD action icons to give them properties and behaviour, after which you place them in rooms along with backgrounds and other things to give your game the look and feel you want. It's in these rooms that the game takes place, and they can be considered essentially as "levels" to your game. If you master the DnD interface and how it works to control basic things in objects, you can then move on to the easy to learn programming language GML which gives you much more control over every aspect of GameMaker:Studio. This help file will tell you the most important things you need to know about GameMaker:Studio and how you can create your own games with it. Please realize that, even with a program like GameMaker:Studio, designing computer games is not completely effortless - so no "make me an MMORPG" button here! Be aware too that there are many aspects to making games that are all equally important: game-play, graphics, sounds, user interaction, etc... but, the most important aspect of all, is patience. While GameMaker:Studio is a powerful tool, it cannot do everything for you at the touch of a button so start small with simple examples and you will realize that not only is creating games great fun, but that learning to use GameMaker:Studio to do it is also very rewarding! For more information, examples, tutorials, ideas and links to helpful forums and other great sites, check out the website http://www.yoyogames.com/ Soon you will become a master GameMaker yourself. Enjoy the experience! Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Installation and System Requirements

Installation and System Requirements


file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm 30/12/2013

Using GameMaker:Studio

Pgina 4 de 134

Installing GameMaker:Studio for personal use.


If your version of GameMaker:Studio has not been bought through Steam, you will need to run the program GMStudio-Installer.exe and follow the on-screen instructions to install. You are given the option to install the program anywhere you like but it is recommended that you follow the default suggestions given. Once installation is completed, in the Start menu you will find a new program group where you can start GameMaker:Studio as well as read the included help file. Installing GameMaker:Studio will also install a number of images, sprites and sound effects on your computer, all of which can be used as "place holders" to get you started making your games (but these are not for use in a final product) and there are also a number of example games installed in the form of Tutorials, as well as some more complex demo examples. All these can be found in folders within the location where you installed GameMaker:Studio and can also be accessed through the GameMaker:Studio startup window and in the IDE itself (from the Help Menu). After starting GameMaker:Studio for the first time, you will be shown a tutorial at the right of the main window. This tutorial will teach you how to quickly create your first game in an easy to follow step-by-step manner, so you can learn to use GameMaker:Studio as fast as possible. This tutorial can be skipped, but if you have not used GameMaker:Studio (nor any previous versions of GameMaker) before then you are strongly advised to work your way through it as it will provide an invaluable insight into how the product works. If you do skip the tutorial, you can always go back and try it later through the Help menu at the top of the main screen. NOTE: If you have bought GameMaker:Studio through Steam, the program should install automatically, giving you the option to create a start menu icon and a desktop icon. Either of these can then be used to run the program on your computer, or you can run it through the Steam Client window library page too.

Basic Requirements
Any computer that is less than five years old should be able to run GameMaker:Studio without any problems, but here are the minimum specs for your PC to use the program, and then the necessary specs for each of the additional modules that you may have. Windows GameMaker:Studio requires a reasonably modern PC running Windows XP, Vista, 7, or later. A DirectX 9 (or later) compatible graphics card with at least 32MB of memory is required for most created games. It requires a screen resolution of at least 1024x768 and 65000 (16bit) colors (but preferably 32-bit true color). Also a DirectX 9 compatible sound card, or integrated sound chip, is required. It is always recommended that you make sure you have the most recent drivers installed for your system. GameMaker:Studio requires DirectX version 9.0 or later to be installed on your computer. (You can download this version of DirectX from

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 5 de 134

the Microsoft website at: http://www.microsoft.com.) When designing and testing games, the memory requirements can be pretty high (at least 128 MB and preferably more, but this depends on the operating system). When just running games, the memory requirements are less severe and depend a lot on the type of game as well as the resources being used. NOTE: Although most modern PCs ship with DirectX 10 and higher, this does not mean that DirectX 9 is present on your machine, and you should still install it from the link given above! Please note that Steam users also have an additional target for compiling games which is the Steam Workshop. While creating and testing your game, this target module will work exactly the same as the standard Windows module, however when creating your final executable you will be shown additional options to submit the game directly to Steam. More information can be found here.

Windows 8 All versions of GameMaker:Studio come with the Windows 8 Native and JavaScript target platforms. These targets require a Windows 8 OS to run (and for testing), and this can be the main OS or a sub-os that you can dual boot with Windows 7 (or any other OS you choose to use), however you cannot create a final application for Windows 8 outside of that OS. You will also need to make sure that you have Microsoft .Net Framework 3.5 installed (.Net 4 is installed as standard with Windows 8, but you may need to install the previous version too) which is available here, although when you install GameMaker:Studio on your Windows 8 OS it should complete this part automatically. Another thing that is necessary is a copy of Microsoft Visual Studio which can be found here. You must only use VS 2012 (the express versions are fine), so even if you have a previous version of Visual Studio, it will not work with this module. A version of this product that supports Windows Store JavaScript app creation is essential as you will need it to create the *.pfx file which is your Developer Key and needed to submit your apps and games to the Windows Store. The GameMaker:Studio Windows 8 export target will create an app specifically for the Windows 8 OS, and it will be compatible with many of the unique features that this OS offers the user. However, if you wish to publish this game through the Microsoft Store for Windows, you must have a Microsoft Developers Licence which is available by signing up for an account here. There is a small cost involved in registering for this account and you will need to have a valid bank account and credit facilities to be able to monetize any apps that you submit to the store. Further information on setting up the Windows 8 modules can be found on the YoYo Games Helpdesk.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 6 de 134

Mac OSX To use the MacOSX target module, you will need to have a Mac computer with an Intel chipset and running Mountain Lion (OSX 10.8) OS or above. You will also need to download and install Xcode for your version of the OS. It's generally recommended that you use the latest OSX and the latest Xcode (you can find the version your Mac has by clicking on the "Apple" logo in the top left and selecting the "About this Mac" option from the drop down menu). Further information on setting up the MacOSX module can be found on the YoYo Games Helpdesk.

Additional Modules
The above modules are included as standard for all versions of GameMaker:Studio but the following modules are available only to those who have upgraded from the Free or Standard version of GameMaker:Studio to the Professional version (more information on the different versions of GameMaker:Studio can be found here). Ubuntu (Linux) The Linux module is designed to be compatible with the Ubuntu operating system, and although it should work with other Linux systems, it is only guaranteed to work with the latest versions of this popular Linux OS. Further information on setting up the Ubuntu module can be found on the YoYo Games Helpdesk.

iOS The GameMaker:Studio iOS module requires that you have a Mac computer (or at least access to one) and that it meets the minimum requirements for the MacOSX target module (see above) and you must be a registered Apple developer and have all certificates and licenses up to date. For more information on becoming a registered Apple Developer and how to get the necessary certificates, please visit the Apple developer site here. Nearly all iOS devices are compatible with GameMaker:Studio including:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 7 de 134

iPhone 4G, 4Gs, 5G iPad 1, 2 & 3 iPod Touch 3rd Gen and above

It also doesn't matter if you are testing on an iPhone or an iPad as all iOS project builds created by GameMaker:Studio are, as standard, universal apps. This means that they will run on both iPhone and iPad devices without problems. Further information on setting up the iOS module can be found on the YoYo Games Helpdesk.

Android Before actually starting to work with GameMaker:Studio and Android, it is worth noting that Android devices vary immensely in capability. The GameMaker:Studio runner will only work with Android 2.2(Froyo) and above (2.1 may work but its performance will not be good), which covers the majority of devices around at the moment but not all of them, so please check and make sure which version of Android your device uses. It is also recommended that your device have a dedicated GPU with Open GL version 1.1 or above. Devices without a GPU will still run your GameMaker:Studio projects, but expect them to have severe drop in performance. You will also need to download the Android SDK as GameMaker:Studio requires some of the components of the different Android versions and the Platform Tools it installs. You can get a copy of the SDK here. if you are also using the YoYo Compiler (YYC) then you will also need to install a copy of the Android NDK which can be found here. Further information on setting up the Android module can be found on the YoYo Games Helpdesk.

HTML5 The HTML5 export module requires only an HTML5 compliant browser. Note that although most modern browsers are capable of running HTML5 games, not all of them support the WebGL standard currently so we recommend Chrome for testing as that shows all the features supported by the module. Further information on setting up the HTML5 module can be found on the YoYo Games Helpdesk.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 8 de 134

Windows Phone Creating games for the Windows Phone module requires that you have installed the Windows Phone SDK 8.0 (download from here). You will also need a Windows 8 PC with the following specifications:

Windows 8, running 64-bit. A 32-bit system is not supported. 4Gb RAM minimum 6.5Gb of disk space

if you do not have a Windows Phone device, you can make use of the Windows Phone emulator, however be aware that these additional requirements will also apply in that case:

Windows 8 Professional or Enterprise Edition Hardware virtualization Second Level Address Translation (SLAT) DHCP, so the virtual machine can get a IP address on the local network

NOTE: The Windows Phone SDK will also install Microsoft Visual Basic Express for Windows Phone as well, so there is no need to install it separately. Further information on setting up the Windows Phone module can be found on the YoYo Games Helpdesk.

Tizen The Tizen target module has certain pre-requisites that must be met before being used, the most important of these is that you must have installed the Tizen SDK (available You can get the SDK here). WARNING!:The current Tizen SDK does not work on Windows 8, so you will need to have an earlier OS installed on your development machine (you can dual boot to Windows XP, Vista, or 7). Also note that the 64bit SDK may not work, even if your OS is 64bit, so if in doubt you should choose the 32bit version. Apart from that you will also need the following:

dual-core 2 GHz CPU

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 9 de 134

At least 2 GB of RAM memory At least 3 GB of free disk space Oracle Java JDK (v6 or above) installed (do not use OpenJDK)

If you do not have access to a Tizen device, you may be able to use the Tizen Emulator, however you must also meet the following requirements for it to work correctly:

A CPU that supports Intel VTx At least 1280 x 1024 screen resolution The most up to date graphics drivers for OpenGL ES acceleration

Further information on setting up the Tizen module can be found on the YoYo Games Helpdesk.

The YoYo Compiler (YYC) The YYC takes the normal GameMaker:Studio output and then compiles that into native code for the target platform, "stripping out" unneeded functions and performing a host of other optimisation techniques to create a smaller and performance enhanced executable. This can increase your games performance by at least two or three times, especially on logic-heavy games, and gives an incredible overall boost to performance, ideal for those larger or CPU intensive games. Although the compiler is classed as a stand-alone module, it is in reality a number of separate modules, one for each available target. So if you have, for example, the iOS and Android modules and then get the YYC, you will see two new modules added to your target list - iOS (YYC) and Android (YYC). Should you get other modules at a later date, the YYC will update too and show an extra (YYC) module for that target platform. NOTE: The YYC is not available for the HTML5 target, nor any of those that are JavaScript (JS) based. The requisites for the YYC target module will depend on the original target modules that you have and wish to use it with, as they will need to be set up correctly before the YYC will work correctly. You can find further information about this from the YoYo Games Knowledge Base as well as on the individual target module Global Game Settings pages detailed in this manual. NOTE: Currently, the YYC is only available for Windows, iOS and Android targets but future updates will add further target modules.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 10 de 134

For further information, advice and troubleshooting please consult the YoYo Games Knowledge Base where you will find detailed information of how to setup all platforms for use with GameMaker:Studio. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Activation

Activating GameMaker:Studio
GameMaker:Studio requires an internet connection to activate your licence before you can use it.
Once you have installed your version of GameMaker:Studio you will be prompted to enter a License Key the first time you run the program (unless you have downloaded the free version or you have bought the program through Steam in which case this step can be skipped as your licence is tracked by Steam for you). The license file will also be emailed to you using the email address you entered during purchase, and if you've logged into the YoYo Games store through the "My Account" section, it will also be tied to that account, allowing you to retrieve it at any time should that be necessary. If you don't have a YoYo Games login, the email will also contain details of the new account that has been automatically setup using the email address you have provided. This will, again, let you retrieve your GameMaker:Studio License code from the YoYo Games website. Once you have completed the licence process, GameMaker:Studio will be ready to use! If at anytime in the future you need to re-install GameMaker:Studio, the latest version, complete with all available updates, can always be found here. It is your responsibility to make sure you save the email, and the Licence Key itself, as you will need it anytime you want to reinstall GameMaker:Studio.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 11 de 134

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 12 de 134

Important While GameMaker:Studio itself does not require an internet connection to be used, it will require occasional access to maintain the license activated. If you cannot connect your computer to the internet for any long period of time, you can download the license check file from the YoYo Games website, and then point the auto update system to it. If you fail to provide a valid license file, or there is no internet connection when requested, your copy of GameMaker:Studio will not work until such time as this is resolved.

Additional Modules
NOTE: These extra modules can only be bought if you have already upgraded to GameMaker:Studio - Professional. GameMaker:Studio comes with a number of export options included when you buy it: Windows and Mac OSX (and Steam Workshop if you bought the program from Steam), as well as Windows 8 (Native) and Windows 8 (JS). However additional modules can be purchased easily from the YoYo Games Checkout. Once there, all you have to do is fill in the required information (e-mail address and GameMaker:Studio base license), then select the target module or modules that you wish to add. After this has been done, clicking "Proceed" will take you to the purchase page to confirm the sale. Finally, once confirmed, you will be given the new license and an email with it will be sent to the address you have given. To use this License, you must now start GameMaker:Studio and go to "Help", "Update License" and enter your new license in the appropriate area. Once that is done, you should close GameMaker:Studio and re-start it to enjoy the functionality of the new modules that you have purchased. Buying Additional Modules From Steam If you bought GameMaker:Studio through Steam you can also purchase these modules easily on-line from the same service, with no licence being required as Steam keeps track of your details for you. To access the available modules, you must run your Steam Client, go to the Library and right click on the GameMaker:Studio entry. From the right click menu that pops up you should select the option View Downloadable Content which will open the application Properties window and there you can select, buy and install the module of your choice. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: GameMaker:Studio Overview

GameMaker:Studio Overview
This section explains some of the some of the core concepts of how GameMaker:Studio works so you can start making games as quick as possible.
file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm 30/12/2013

Using GameMaker:Studio

Pgina 13 de 134

The Global idea


Before delving into the possibilities of GameMaker:Studio it is good to get a feeling for the idea behind the program. Games created with GameMaker:Studio take place in one or more rooms. Now, these Rooms are flat 2 dimensional spaces but they can contain 3D-looking graphics as well depending on how you use them. In these rooms you place objects, which you can define within the program. Typical objects can be walls, moving balls, the main player controlled character, enemies, and anything else you can think of from games that you have played! Some objects, like walls, just sit there and dont do anything, while other objects, like the main player controlled character, will move around and react to the input received from the player using keyboard, mouse, or joystick. For example, when the main character meets an enemy he might die or he might fight the enemy and score points. As you can see, objects are the most important ingredients of games made with GameMaker:Studio, so let us talk a bit more about them.

An Overview of Objects and Rooms


First of all, most objects, when placed as instances within a room, need some image to make them visible on the screen. Such images are called sprites. A sprite is often not a single image but a set of images that are shown one after the other to create an animation and in this way it can look like a character is walking, or a ball is rotating, or an enemy is exploding, etc... During the game, the sprite of a particular instance of any object can be changed, so a character can look different when it walks to the left or to the right, for example. You can create your own sprites in GameMaker:Studio or load them from files and use them "as is" or edit them yourself with the powerful GameMaker:Studio sprite editor. Here is an example of how a typical object looks: For an object to actually do something, we need to give it actions, but we also need to tell it when to complete these actions. To do that we use EVENTS. An EVENT is a special moment in which we can place certain actions and be sure that those actions will only happen when that EVENT is triggered. There are a large number of different events that can take place and a large number of different actions that you can let your objects take too. For example, there is a Create Event that is performed only when the object gets created. Actually, that's not quite true! Objects are never created, rather they are used to create instances... An instance is a copy of the base object, complete with all the same events and actions, and it's these that are used in your games. think of an object as the blueprint, and the instance as a manifestation of that blueprint. For example, to add motion to a ball object when we create an instance of it in a room, we would add a motion action to the create event of the object. Another example of an event is the Collision Event. This is triggered when two instances of any objects collide in the game room. In such a case you can make the instance stop or reverse direction or any number of other actions, like play a sound effect or add points to a score. Further events include the Keyboard Event (for when the player presses a key), Mouse Event to detect mouse buttons, and the Draw Event which is where we can tell each instance of an object to draw whatever we want. There are still more events for each object and these are covered further along in the manual. Once you have defined your objects it is time to define the rooms in which they will be placed. Rooms can be used for levels in your game or to show information or even to hold a start menu. There are actions to go from room to room so that you can create button objects that, when pressed, will move the player from one room of the game to another. It should also be noted that if you do not have any rooms in your game then GameMaker:Studio will

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 14 de 134

not run. But how do you create a room? GameMaker:Studio has a complete editor for creating these areas and in the editor you can add and change many aspects of how the room will look and play. For example, you can add backgrounds in that can be either a simple color or an actual image. Such background images can be created in GameMaker:Studio with its own editor, or you can load them into the resources from files. Backgrounds can actually be made to do a lot of things but for the time being, just consider it as something that makes the rooms look nice. Next, you can place one (or multiple!) instances of any objects you have created into the room. For example, you want to have a large walled area in your game, so you would define one wall object and then place multiple instances of that object in your room to create large, complex walled areas. The same can be done for enemy objects too! Just make one enemy object, and then place multiple instances within your room to get a whole level created from only a few base objects. Here is an example of how the room editor typically looks: Once you have completed the design of your rooms, you are ready to run the game. The first room to be shown is always the first room in the main list of rooms and it will be run at the start. Now the instances you have placed will come to life because of the actions defined in their object create events and they will start reacting to each other due to actions placed in the object collision events. They will also react to the player using the actions placed in any keyboard or mouse events. That covers the two most important things in GameMaker:Studio, but there are a few more! All together they are called resources and assets, and in the main screen of GameMaker:Studio you can find them on the left-hand side in a space called the resource tree. Here is a list of them and you should know that they will all play a crucial role in creating your game:

Sprites: images (often animated) that are used to represent the objects Sounds: can be used in games as either background music or as sound effects Backgrounds: still images used as background for the rooms Paths: these can be used to make instances move along a pre-defined path Scripts: a script is a piece of code to which you give a name and use like a GML function Shaders: a shader is a combination of two "programs" written in a shader language to create graphical effects. Fonts: to draw text in the game you can add fonts of many different styles Time lines: can be used to control the precise moment in a game that things should happen Objects: which are the building blocks on which your game is built

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 15 de 134

Rooms: the space (levels) in which the objects are placed Included Files: files that your game will export to the chosen target for use Extensions: the extensions included with your game to expand functionality Constants: a per-configuration list of the constants that you define for your game

Please note that the above resources and assets have certain limitations if you are using the Free version of GameMaker:Studio. For a complete list of these limitations please see here.

Note: To help you get familiar with GameMaker:Studio, it is strongly recommended that you follow the tutorial that is shown when you first start the program. If you removed the tutorial from view, you can always make it visible again by choosing Tutorial in the Help menu. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: The Graphical User Interface

The Graphical User Interface (GUI)


This page outlines options available to you from the GameMaker:Studio GUI.
On starting GameMaker:Studio the following form is normally shown which presents you with a selection of options to choose from (unless you use the Steam Client, see below):

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 16 de 134

If you have bought GameMaker:Studio through Steam, then on startup you will be presented with an options screen (shown below) from which you can select to Play games from the Steam Workshop, or to Make games with the program. If you select Play then GameMaker:Studio will close and the Steam player will open, however if you choose Make then you will be presented with the standard GameMaker:Studio startup screen.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 17 de 134

At the top of the general startup screen you can see that there are six tabs: Welcome (always the initial startup screen), News, Create, Tutorials and Demos. Here is a brief overview of the function of each of those tabs:

Welcome: This is the startup screen you see when opening up GameMaker:Studio. At the bottom you have a list of previously opened files. Open: Here you can browse your computer for files to open. New: This will ask you to select the directory you wish to use for a new project and prompt you to enter a name for this project which is then saved and opened in the main GameMaker:Studio runner. Import: Here you can load up the compressed *.gmz project files and also import game files created with other versions of GameMaker, including GameMaker 6 (*.gm6), GameMaker 7 and 8 (*.gmk and *.gm81) as well as GameMaker 8.1 (*.gm81) and much older (*.gmd) files. It should be noted, that the older the file type, the less likely they are to run without a lot of rework due to the changes wrought in GameMaker through the years. Additionally, you can load up GameMaker backup files (*.gb1, *.gb2 etc) from this tab too. Release Notes: If you click on this button you can see the release notes for each released version of GameMaker:Studio. These notes outline all the bug fixes and changes that have been incorporated into the program and tell you which version you are currently using. Demos: This will allow you to view demo files that come with GameMaker:Studio. Demos are different to tutorials in that they focus on explaining just one function or concept rather than giving a general overview, and as such it is recommended that you have a working knowledge of GameMaker:Studio and GML before opening these. Tutorials: This tab shows you a selection of tutorials that come with GameMaker:Studio. These are designed as an introduction to using GameMaker:Studio and it is recommended that new users look them over before starting any new projects of their own. News: This will display the most recent news from YoYo Games. This news includes information about GameMaker:Studio

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 18 de 134

development, new versions, competitions and anything else that has been posted on the YoYo Games website. Licenses: This tab will display the GameMaker:Studio license, as well as all the various third party licenses of products that are used.

To begin creating your game, you can click on either the Create tab or the New project button, whichever you find more convenient.

Once you've loaded up your project in GameMaker:Studio the main GUI is shown and looks something like this:

This is the main interface for GameMaker:Studio and it's here that you control every aspect of your current project. On the left, you can see the different resources mentioned in other sections of the manual: Sprites, Sounds, Backgrounds, Paths, Scripts, Fonts, Time Lines, Objects, Global Game Settings and finally, Extensions. At the top of the window there is the menu and a handy tool-bar to access some of the most used commands when creating a game. We will briefly discuss the various menu items, buttons, etc... below, but they will be covered far more in-depth in the later sections of the manual. One thing you should realise at this point is that many of the same things can be achieved in various different ways when working with GameMaker:Studio, either by choosing a command from the menu, by clicking a tool-bar button, or by right clicking on a resource. This redundancy is there so that you can get working with GameMaker:Studio in the easiest and most natural way, using whatever system you feel most comfortable with. Steam users have three additional buttons on the toolbar: This first button will open the Steam Player where you can play any games you have subscribed to or uploaded to the Steam Workshop. This second button will open up the page of the GameMaker:Studio Steam Workshop in the Steam client window on your PC. The final button available to you will open another version of the GameMaker:Studio IDE so you can have two (or more) projects open at one time.

The Resource Tree


At the left of the main form you find the resource tree. Here you will see a "tree" view of all the resources in your game. It works in the same way as Windows Explorer, and you are most likely familiar with how it should work. If an item has a + sign in front of it you can click on the sign to see the

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 19 de 134

resources inside it (expand it). By clicking on the - sign these disappear again (collapse it). You can change the name of a resource (except the top level ones that show the type of resource contained within) by selecting it once with a single click, and then giving another single click on the name once again. Double clicking on a resource in quick succession will automatically open its properties form where you can edit and change things related to it. Use the right mouse button to call up a context specific window that contains the same commands as found in the Edit Menu. You can change the order of the resources by clicking on a specific resource and then dragging it to the appropriate place within its resource group.

The Toolbar
The toolbar in GameMaker:Studio contains buttons to create each of the resources you see present as well as a selection of additional buttons to create a new project, open an existing project, save a project, create an executable (export a final project), open the global games settings and extension packages as well as opening the help file. All these commands can also be accessed through the drop down menus or by using certain "hot key" combinations. There are two buttons of note here however, as they are not present anywhere else in the GameMaker:Studio GUI: Stop Web Server

This button can be used to cancel the compilation of your games to the target module, or (on certain targets only) to stop the game while it is running after it has been compiled. Clear Project Asset Compile Cache

Pressing this button will clear the current asset compiler cache. GameMaker:Studio stores images, sounds, scripts etc... between use in a cache so as to save time when testing your game as it will only re-compile those things that have been changed before testing. However, this cache may become corrupted over time, or you may wish to do a full test with no caching being done previously, in which case you can clear the cache by pressing this button.

The Compile Target


This drop down menu allows you to choose which device to target when compiling and testing your game. In this way you can quickly change between

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 20 de 134

the different modules that you have installed on GameMaker:Studio and make sure that your project works as it should on all of them. The available target modules are: Windows included in all versions MacOSX included in all versions Windows 8 (JavaScript) included in all versions Windows 8 (Native) included in all versions Steam WORKSHOP included in all versions of GameMaker:Studio bought through Steam HTML5 additional module for the Professional Version Ubuntu (Linux) additional module for the Professional Version iOS additional module for the Professional Version Android additional module for the Professional Version Tizen additional module for the Professional Version Windows Phone additional module for the Professional Version Please note that the additional modules can only be bought for the Professional Version of GameMaker:Studio, and if you have bought GameMaker:Studio through Steam, you will also have another target platform for your game which is the Steam Workshop. This target will permit you to publish your windows games straight to Steam for others to download and play. For more information on this target please see here.

Configurations
Here you can find a drop down menu that permits you to select the current configuration of GameMaker:Studio and beside this there is a button labelled "Manage". By clicking this you can open the Configurations Window which permits you to add, remove and rename configurations. For more information on configurations see this section: 1. Advanced Use - Configurations NOTE: This functionality is limited to the Professional Version of GameMaker:Studio.

The Workspace
This is the area where you will be editing your resources, setting up rooms and working with your objects, code and all other resources.

The Main Menus

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 21 de 134

At the very top of the GUI you will find the drop down menus. As there are a number of them and each has its own selection of options, you can find out more about them from the pages listed below: 1. 2. 3. 4. 5. 6. 7. The File Menu The Edit Menu The Resources Menu The Scripts Menu The Run Menu The Window Menu The Help Menu

Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Loading Sprites

Loading Sprites
In this section of the manual you can learn about sprites and how to create them with the GameMaker:Studio sprite editor.
Sprites are generally the visual representations of objects within the game you are creating. As such, a sprite is either a single image, drawn with any drawing program you like, or a set of images that, when played one after another, looks like a looping animation. For example, the following 10 images form a sprite for a character who is waving his arms while skydiving.

And the actual finished animation would look like this when placed in a game:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 22 de 134

That looks pretty good, eh? Most games need you to make sprites like this for all the things in your game world, from enemies to power ups, from walls to menus, and when you start to make a game you normally collect or create a set of nice sprites for the objects you are going to use. A considerable number of useful sprites are bundled with GameMaker:Studio to help you get started and other collections of useful sprites can be found on the YoYo Games website which can all be used as "place holders" until you have enough confidence to make your own or get together with an artist, but please note that the bundled sprites are not for distribution in any finished works that you make. You can also find many more sprites on the web, normally in the form of png strips or animated gifs. To create a sprite, choose the item Create Sprite from the Resources menu, or use the corresponding button on the toolbar. Either will cause the following window to open:

As you can probably see, the top left of the window has a field for the "Name" of the sprite. All sprites (and all other resources) must have a name given to them so that you (and GameMaker:Studio!) can identify them easily, although you should note that the actual name itself is really just a variable

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 23 de 134

which holds a number that "points" to the resource, in this case a sprite. It's best to give each sprite a descriptive name so that you can identify at a glance whether a particular resource is a sprite or an object or anything else, and many people do this by prefixing or suffixing the resource with the letters "spr". For example, the above sky diver sprite could be called spr_SkyDiver or SkyDiver_spr. Even though this is not strictly required, you are strongly advised to use only letters and digits and the underscore symbol (_) in a name of a sprite (and any other resource) and to let it start with a letter, not a number as this will become very important once you start using code. NOTE: If you are using the Free version of GameMaker:Studio you are limited to a maximum of 20 sprites per game. For more details see here.

To load a sprite, click on the button Load Sprite. A special file dialog window opens in which you can choose the sprite you want to import into GameMaker:Studio:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 24 de 134

The left part is a fairly standard file selector in which you can navigate around your computer and select the sprite that you want to import. On the right you have a preview of the sprite image you select and some basic information about its size. Here you can also indicate a couple of things that you'd like GameMaker:Studio to do when you import the sprite, like make opaque (remove any transparent parts), remove the background color (if it has one) making it transparent, or whether to smooth the edges of the sprite (only if it is transparent), which can greatly improve its appearance. When you have found the sprite you need and selected the transparency options you like, press Open to load the sprite into GameMaker:Studio. GameMaker:Studio can load many different formats of graphics file, including jpeg, bmp, png and gif. There are a couple of things that should be noted when loading different files:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 25 de 134

When you load an animated gif, the different images of the animation automatically form the sprite subimages. When the file name ends with _stripXX, where XX a number, it is considered to contain a strip of XX subimages next to each other, and GameMaker:Studio will import it as such. For example, an image file with name ball_strip4.png is assumed to contain 4 subimages and will be split up as such when loaded. If you have a sprite strip image that you wish to load into GameMaker:Studio which does not have the above-mentioned format, this must be done from the Sprite Editor File Menu. Although jpeg images are supported, it is best to avoid using this file type as, due to the compression used, the images are generally of poorer quality than either png or bmp.

Once the sprite is loaded you are returned to the sprite properties window where the first subimage is shown on the right of the screen. When there are multiple subimages, you can cycle through them using the arrow buttons that appear beside the part of the window labelled "Show", and, should you make any changes to the sprite, you can then save it again using the "Save" button. For a more in depth look at the sprite editor in GameMaker:Studio you can go to the Advanced Section of this manual. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Sounds And Music

Sounds And Music


This section explains how to add a sound resource to your game.
To add a sound resource to your game, use the Resource menu or right-click on the resource tree and select Create Sound, or you can use the corresponding button on the toolbar. Any of those will bring up the following window: To load a sound, press the Load Sound button to the right of the sound name. A file selector dialogue pops up in which you can select the sound file, which can only be either a wave file or an mp3 file. In general, Wave files (*.wav) are used for the short sound effects as even though they are generally larger files they will play instantaneously due to the fact that they do not need any type of decoding for playing. You can also have multiple wave files playing at once, which is why you should use these for all the sound effects in your game. Mp3 (*.mp3) files should be used for background music as GameMaker:Studio only permits you to play one music track at a time. These files are much

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 26 de 134

smaller than a wave file would be but have a small CPU overhead as they have to be decoded before being played, hence the limit of only one mp3 file being played at time (however, you can have multiple music tracks in your game, and you would just switch between them when necessary). Once you have loaded your file you can preview the sound by using the play button which will loop it continuously. This is very handy as it means you can make changes to the volume using the slider at the bottom of the window and hear what the effect it will have on the sound. There is a stop button too, so you can stop the preview at any time. NOTE: If you are using the Free version of GameMaker:Studio you are limited to a maximum of 10 sounds per game. For more details see here. NOTE: Previous versions of GameMaker accepted midi file format but that is not the case with GameMaker:Studio. You cannot use midi any longer and any imported files from legacy versions which use these may cause the program to crash. These files should be removed or changed before testing! The sound window also has other options which are explained below.

Compression
The above rules for file types are for the default configuration of Uncompressed audio. However, you can select to Compressed audio should you wish to use that. What this will do is force all your sound files (irrespective of whether they are *.wav or *.mp3) to be compressed down to Ogg Vorbis *.ogg format files for all platforms. These sounds are smaller on disc, but will have a slight CPU overhead due to the need to be uncompressed before being played, so you should keep that in mind if you wish to use compression in an already CPU intensive game. It is also worth noting that using compressed audio will permit you to use the audio_sound_* functions for both music and sound effects, permitting you to "layer" music or change its pitch etc... With uncompressed audio you must use the audio_music* functions to play *.mp3 files, and will only be able to have one music track playing at a time.

Streaming
If you have chosen compressed audio, you can then also choose to have your sound as streamed or not streamed. A streamed sound will be one that is uncompressed and played in real time, streamed form the disc. Streaming is ideal for music as it reduces the one off overhead of uncompressing the whole file, which may cause a pause in the game, but is not recommended for simple sound effects where the hit on the CPU is much less.

Target Options

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 27 de 134

The Target Options panel is where you set the conversion rates for your game. These settings will affect how the sound is exported for the target platform, and GameMaker:Studio will automatically convert your sound files for you - you simply control the final quality of those sounds when converted. Generally the default settings of 16 bit, 44100kHz and 192kbps are perfectly adequate, but it may be that you wish sound effects (for example) to have a lower quality and music to have a higher quality, in which case these settings can be changed. You can also choose whether the conversion should be mono, stereo or 3D. If you plan on using the audio emitter functions to create 3D sound effects, you should indicate this here, otherwise choose mono or stereo depending on the use that the sounds are going to be put to. NOTE: The higher the quality, the larger the file, and this should be taken into account when deciding what bitrate to choose.

External Editor
GameMaker:Studio does not have a built-in sound editor. But, in the Editor Preferences, you can indicate external editors that you want to use for editing sounds. If you selected these you can press the button labeled Edit Sound to open the chosen editor and change the current sound. The GameMaker:Studio window will be hidden while you edit the sound and returns when you close the sound editor (you must save the sound in the editor first otherwise it will not be saved in GameMaker:Studio). Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Backgrounds

Backgrounds
Backgrounds are another of the basic resources that you can use in GameMaker:Studio.
These are usually large images that are used as backgrounds (or foregrounds) for the rooms in which the game takes place, but they can also be large images composed of many smaller ones called tiles which you can then place individually in your room to create complex visual designs for levels with far less processing overhead than you would get with objects and sprites. NOTE: If you are using the Free version of GameMaker:Studio you are limited to a maximum of 5 backgrounds per game. For more details see here.

To create a background resource in your game, use the Create Background option from the drop down Resources menu or use the corresponding button on the toolbar. Either of those will cause the following window to open:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 28 de 134

As with all resources, you must give a name to your backgrounds for reference within GameMaker:Studio and so you can identify them easily, although you should note that the actual name itself is really just a variable which holds a number that "points" to the resource, in this case a background. It's best to give each background a descriptive name so that you can identify at a glance whether a particular resource is a background or an object or anything else, and many people do this by prefixing or suffixing the resource with the letters "bck". For example, the above image could be called bck_Horizon or Horizon_bck. Below the "Name" section are the buttons that enable you to load, save or edit a background image. If you select "Load Background", you will get the standard file selector where you can choose supported image file (png, gif, bmp, jpeg.) and also tell GM to make that image opaque (remove transparency), or make it transparent (this takes the color from the bottom left hand corner pixel as the base color to make transparent) or to smooth the edges of the background (only when it is transparent). Once you have selected the file and the options, clicking the "Open" button will load the background into GameMaker:Studio ready to be used in your games. Editing the background can be done within GameMaker:Studio too, and we have a whole section in the Advanced Use part of the manual that deals with this here.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 29 de 134

Be careful with using large backgrounds, especially if your target device is Html5 or one of the smaller mobile devices, as large backgrounds need more memory and this could be a problem later when you try to compile your game. You should also be aware that backgrounds in GameMaker:Studio are designed to tile and this means they have overlapping pixels on either side, so if you see any strange artefacts (transparent lines, extra pixels etc.) then you should possibly be using sprites instead for the graphical effect you wish to achieve.

Editing Backgrounds
For editing backgrounds, GameMaker:Studio has its own included Image Editor which is quite powerful, although not as complete as many dedicated art packages available. For information on how to use it, please see the section More About Sprites: Editing Subimages as there is exactly the same set of tools available for backgrounds as for sprites.

Backgrounds as Tiles
Sometimes you want to have a background image broken up into a set of tiles, which basically means, one large image composed of different sub images that can all be linked together. When creating rooms you can then add these subimages at different places to create beautiful levels with graphical effects that are "cheap" in that they use very little processing power to draw. Please note that tiles are purely graphical and do not have most of the properties you would find in an object or a sprite which is why they are fast. To use a background as a tile set, check the box labelled Use as tile set and the background window now changes to look as follows:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 30 de 134

Now you can indicate a number of settings for the tile set, like the width and height for each tile (only one size can be given, so better make sure that all tiles in the set have the same size. If you have different sizes, create two or more tile sets). You can also indicate an offset (in pixels) where the top left-most tile starts as well as a separation between the tiles (in pixels) between the tiles themselves. For more information on tiles see the section in the Advanced Use part of the manual More About Backgrounds, and for information on how to use tiles in the room editor you can go to the section More About Rooms. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Defining Objects

Defining Objects

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 31 de 134

Objects are the fundamental "building blocks" within GameMaker:Studio.


With the resources you have seen so far you can add some nice images and sounds to the game resource tree, but they don't do anything in the game itself yet! For that we need the most important resource of GameMaker:Studio, the objects. Objects are a special resource that we use to control aspects of a game and to do specific things. Most of the time they have a sprite associated with them so that you see them in the game rooms, but sometimes they are used as a "behind the scenes" controller to do things related to the user or for timing etc... They can be given behaviors and they can react to certain events as well as to each other, and most of the things you see in a game are based on objects and their interactions. Now, I say "based on" because you don't actually place objects directly into the game rooms, but rather you place instances of these objects which are basically copies (or clones if you prefer) of the object resource. This is a very important thing to remember as instances and objects are not the same thing and each have their own set of functions that can affect them. NOTE: If you are using the Free version of GameMaker:Studio you are limited to a maximum of 10 objects per game. For more details see here.

Objects and Instances


In a game made with GameMaker:Studio, the characters, monsters, balls, walls, etc... are all instances copied from a basic object template that is found in the GameMaker resource tree and then placed in a room. So when we talk about something affecting or changing an instance, we mean that one particular copy of an object in a room is being affected while all the rest are not, but when we talk about affecting or changing an object we mean that anything we do to it will be reflected in all the instances created from that point on too. So, the object is the template for the instance, and the instance is what we place in a room to make our game.

Creating an Object
To create an object in your game, choose Create Object from the Resources menu (or click the equivalent button on the toolbar) and the following window will open:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 32 de 134

At first glance this may seem rather confusing, but the window is split into sections and we shall cover each one individually so you can get an overview of what they are for. Starting on the left, there is some general information about the object, then in the middle there is the list of events (moments in time) for the object and the window to place the actions that are to be performed in those events, and finally on the right there are the actions themselves which you can select for the object to perform, grouped under different tabs for ease of use. Events and actions will be discussed in more detail in following sections of the manual. If you have "Uses Physics" selected then there will be another part visible in this window related to the physics options, but more on that later! As you would expect, you can (and should always) give your object a name. This should never contain spaces nor unauthorized characters and should be short but memorable so that you can easily identify resources later when you may have many of them, for example may people use a prefix or a suffix to identify the differences between resources, like "obj_Ship" or "shop_obj". Next you can choose the sprite for the object should you wish it to have one. To this end, click with the left mouse button on the sprite box or the menu button next to it and a pop-up dialogue will appear with a list of all

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 33 de 134

the available sprites from the resource tree, then just select the one you want to use for the object. If you do not have an appropriate sprite yet, you can click the button New to create a new sprite resource and edit it as you wish, just as if you had created the resource through the standard creation options, only now when you click okay, it will automatically be assigned to the object that you had open when you started to create it. Once you select a resource there will be an additional Edit button here that you can use to change the sprite too. This can be faster than first finding the resource in the list of resources and then indicating you want to edit it. Below this there are many other options which are all outlined below:

Visible
Visible indicates whether instances of this object are visible when the room starts. Normally most instances are visible but sometimes it is useful to have invisible ones - for example, you can use them for way-points to control a moving monster, or to keep track values and perform certain timed actions. Invisible objects will still react to events and if they have a sprite or a mask assigned to them, they will also react should other instances collide with them... they just can't be seen and do not perform their draw event.

Solid
By checking solid you are indicating to GameMaker:Studio that it should consider instances of this object to be a solid object (like a wall). Collisions with instances of solid objects are treated differently from collisions with non-solid objects and as such you are strongly advised to use Solid only for objects that are not moving.

Depth
You can set the Depth of the instances of an object, which basically controls whether they go below or above other objects at other depths. When instances are drawn on the screen they are drawn in order of depth, with instances that have the highest depth being drawn first and instances with the

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 34 de 134

lowest depth being drawn last. The following image illustrates this behaviour: It should be noted here that instances of the same depth that over-lap each other in the room editor (or in game) have no guaranteed priority over which one will be "on top" of the other and. If you want to guarantee that an object lies on top of the others then you must give it a negative (or low) depth. Conversely If you want to make sure it lies below other instances then you have to give it a positive (high) depth. Depth can also be changed in-game as it has its own variable that can be changed and manipulated by actions or in code.

Persistent objects
Below depth there is the option to make an object persistent. A persistent object is one that does not go away when the room is changed, but rather it "persists" and is carried over into the new room. It will only disappear when you explicitly destroy it, either with a destroy action or in code. This means that if you place a persistent object in one room, it will still be available in all subsequent rooms and will continue to perform any actions assigned to the events in its object properties. This is handy for when you have, for example, a main character that moves from room to room and you want to maintain the variables within that object the same, but unless you take great care to create and destroy persistent objects correctly, you can easily get errors creeping into your project.

Parents
One of the most powerful options within the object properties is the ability to assign a parent. Every object in the game can have a parent object, but what does this mean? Well, when an object has a parent, it can share code, actions and events with that parent. This is called "inheritance" and an object that has a parent is called a "child". But that's not all! You can also do checks and run code on parent objects which automatically include the child

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 35 de 134

objects too which saves a lot of time and energy. Another way to look at a parent object is as a way to "group" objects together under the same umbrella and have them share certain things without loosing their own identity. For more information on parents (and other advanced object properties) see More About objects. Please note that you can click the Parent button to automatically open the assigned parent object.

Masks
When an object has a sprite, it also has a mask. This is usually defined by the sprite itself (and can be changed in the sprite editor) but sometimes you may want an object to have a different shaped mask to its sprite, or even have no sprite but still a mask. Why? Well, masks are what govern collisions in GameMaker. When two instances come together, GameMaker has to decide whether a collision has occurred and to do this it relies on the mask of the object, either the one defined here or the one that is defined in the sprite properties. If you have no mask then you have no collision! It should also be noted that if you have assigned a sprite to the object and then assign a mask, GameMaker will always base collisions off of the assigned mask and NOT the sprite. For example, if you make an isometric game, objects typically have a height (to give them a 3D view), but for collisions you only want to use the "feet" part of the sprite. This can be achieved by creating a separate sprite and then assigning that to be used as the collision mask for the object. Please note that you can click the Mask button to automatically open the assigned mask sprite.

Information
The button Show Information gives an overview of all information for the object that can also be printed out or saved as an html file. This is particularly useful when you want a loose overview of all your actions, code and events or if you to debug something within the object.

Uses Physics
When you check this box you are telling GameMaker:Studio that this object should be part of a physics world. This will also open another part of the object window where you can define the physical properties of all instances of this object. More information on this can be found in the Advanced Use section of the manual under More About objects. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Events

Distributing Your Game


Here we talk about how you can distribute your finished game
With the information in the preceding sections of this manual you can begin to create your games, but when your game is finished you obviously want other people to play it. You can of course export a *.gmz file and let them use GameMaker:Studio to play it but this is normally not what you want!

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 36 de 134

First of all, you don't want others to be able to change the game or get access to all your hard work, and secondly you also want people to play the game even if they do not have a copy of GameMaker:Studio. So you would like to create a stand-alone application or package of your game, or upload it as HTML5 to a site on the internet so that everyone can play it!

Creating Your Stand Alone Game


Creating stand-alone applications is very easy with GameMaker:Studio. First you have to choose the "target" for the files to be made which means choosing whether you wish to create an *.exe for windows, generate JavaScript and HTML for use in a browser, or create a package for one of the other target modules. Each of the individual targets has their own settings and you must ensure that they are correct configured in the Global Game Settings and Preferences before you continue. Once everything is correct, you then go into the File menu and select the item Create Executable or you can press the following button, found on the main IDE toolbar beside the Play and Debug buttons: Create Executable For Target Either option will open a save window where you can give the final name that you wish to use for your game file. Once you have done this, the necessary files will be generated so that you can distribute it as you wish. NOTE: Before doing a final build of your project for release, you should always clear the Asset Compiler Cache (using the green "broom" icon at the top of the IDE) to ensure that all cached files are recreated and no stale files corrupt your final game.

Target Platform Formats


Each target option saves to a platform specific format:

If you have the setting as "Windows" in the main GameMaker:Studio window, then only a windows compatible file will be made. This can be an installer, a stand-alone *.exe or a *.zip. The export file type is chosen from a drop down menu within the "Save" dialogue itself, as shown by the image below:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 37 de 134

If you have chosen to build HTML5, then an index.html (default name, but you can give your own name too) along with a folder containing your game's files will be created and saved to the specified location. For your game to work you will need both of these to be uploaded to a server. The index.html can also be customised to show your game with a different background color, or at a different position etc... but a knowledge of the HTML language is necessary for this (see the HTML5 Tab of the Global Game Settings). For Android devices, a *.apk file will be generated which can be used directly on any Android devices or uploaded to the Google Play or Amazon stores (or any other site that accepts Android apps). For an iOS or Mac build you will need all the appropriate developer permissions and an Apple Mac computer. GameMaker:Studio

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 38 de 134

will create a *.dish file which you will then need to prepare in the Application Oven app on a Mac. This will then generate your iOS or Mac app for you. For the Windows 8 (JS and Native) module an *.appx file will be created, along with its manifest and a number of other files that are needed for your game to work as a native Windows 8 app. These will all be stored in a folder in the location (and with the name) of your choice. For the Windows Phone device target module, an *.xap file is generated which can then be used by all compatible devices or uploaded to the MS Store. For the Tizen target module, a *.wgt file is generated which can then be used by all compatible devices or uploaded to the Tizen app stores. If you have bought GameMaker:Studio through Steam then you can also compile to the Steam Workshop. For more information see here.

Please note: GameMaker:Studio uses a C++ runner to create all final games and apps. The previous GameMaker versions used Delphi, so this means that any game imported from previous versions may not work without certain changes. For further information on how to compile a final game for your target platform, and for details on how to upload these to the various app stores available, please see the YoYo Knowledge Base.

Distribution
Once you have created a stand-alone application or package for your game you can then give the file to other people or place it on your website to download. You can also upload these files to the different hosting services for individual distribution or to online stores (like Google Play, iTunes or the MS Store) for general distribution and retail. Further information on these formats and file creation can be found on the YoYo Knowledge Base. You are free to distribute the games you create with GameMaker:Studio in any way you like, and this means that you can even sell them! Of course, this assumes that the sprites, images, and sounds you used to make it can be distributed or sold as well and that you have the legal rights to all assets. See the enclosed license agreement for more information on this (available on the Licences Tab). Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Game Information
file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm 30/12/2013

Using GameMaker:Studio

Pgina 39 de 134

This section deals with the Game Information window.


Beneath the resource tree on the left of the main GameMaker:Studio IDE you have the Game Information. Clicking on this will bring up a rich text editor as shown in the following image:

The game information is basically a scratch pad for you, where you can draught out ideas, to-do lists, contact details and any other information that you may need at a later date or that you don't want to forget. Unlike previous versions of GameMaker this form cannot be shown to the player and as such it is the ideal place to store snippets of information and to plan your game. Back: Using GameMaker:Studio Next: Distributing Your Game

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 40 de 134

Copyright YoYo Games Ltd. 2013 All Rights Reserved

Steam Player
Here you can find all the information about the Steam Player.
If your copy of GameMaker:Studio has been bought through Steam, you will see that when you start GameMaker:Studio you are presented with a splash screen containing two buttons - Play and Make. Pressing the Make button will open the standard GameMaker:Studio User Interface where you can begin to create your own games, but pressing the Play button will open the Steam Player:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 41 de 134

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 42 de 134

This player will be empty to start with as you must first visit the Steam Workshop and subscribe to the games that you wish to play. Once this has been done, they will be visible in the Player (you may need to close and restart the Player for these changes to be visible) listed on the left hand side and selecting any one of them will show a screenshot, user information and also permit you to download them by clicking on the "Download" button. Once

they have been downloaded, this button turns into a "Play" button and clicking it again will start the game. Beneath the Download/Play button is the Subscribed button. This can be used to unsubscribe the selected game from the player simply by clicking on it, which will

turn the button into a green Subscribe button. You may click this again to re-subscribe to the game, but bear in mind that this option is only available until you close the player. Once closed all unsubscribed games will be removed from the play-list and to re-subscribe you must search for them on the Workshop pages. Finally, on the left of the player is the "Workshop" button and the "Back" button. The "Workshop" button will open up the Steam Workshop for you in your default browser, while the "Back" button will take you back to the main start-up screen where you can choose to start GameMaker:Studio, or restart the player again (this button is only available when the player has been launched from the splash screen and not from GameMaker:Studio). Back: Steam Workshop Copyright YoYo Games Ltd. 2013 All Rights Reserved

Steam Workshop
Here you can find all the information about the Steam Workshop target module.
If your copy of GameMaker:Studio has been bought through Steam, you will see that there is an additional target module for compiling to apart from

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 43 de 134

the standard Windows and MacOSX targets: When running your game through GameMaker:Studio normally (or in debug mode), this target module functions exactly the same as the standard Windows compiler and will permit you to play and test your game in the windows workspace. However, when you decide to compile you game using the Create Executable command from the file menu or the icon from the toolbar you will be creating a special file which will be uploaded directly to the Steam Workshop.

What Is Steam Workshop?


Steam Workshop is basically a platform for user-generated content, where you can upload your games and have others play them, rate them and comment on them. The games you upload can be works in progress or finished games, but they cannot be for sale as the nature of the Workshop is to offer user created content for free. You should also be aware that the games uploaded to the workshop cannot make use of extensions in any form as Steam consider them to be a security risk. You can have included files however, and you need not worry about whether your games will work on MacOS, Ubuntu (Linux) or Windows as that side of things is handled by Steam.

Uploading To The Steam Workshop


When you select the Create Executable for Steam Workshop, a new window will open where you must specify certain details that Steam require for

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 44 de 134

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 45 de 134

you should add the name of your game (this is what people will see displayed on Steam), then upload a screen shot to show something of your game itself. The screen shot may appear stretched or distorted in this window, but once uploaded it will appear as it should to those that visit the Workshop page for your game. You should then select the visibility of your game which can be either:

Private - The game will only be visible to you, Steam administrators, and anyone marked as co-creator. Friends Only - The game will only be visible in searches to you, your friends, and Steam administrators. However, anyone with a direct link may also view it. Public - The game is available to the general public through the Steam Workshop.

After that you can add a description of your game, which can be as long or short as you wish, and finally, at the bottom, you can add search tags too. The search tags are limited to a maximum of three, where the first one must be the "Genre" of the game which you select from a drop-down menu. The other two tags are used for giving the description and can be custom tags that you input (click the box and write the tag) or they can also be selected from a long list of pre-made descriptive tags accessed through another drop-down menu. When you are happy with the information, you can click on the button labeled Create and your file will be sent to the Steam server automatically. In a few minutes (depending on your internet speed) you should be able to access the file on your Steam account page where you can also modify all the details that you have included when uploading, including adding more screen shots, changing the visibility and editing the description (if you have the Steam client open, you can get to your files through the Community > Workshop > Your Workshop Files).

Playing Your Games


Once you have uploaded a game, to be able to play it you must first subscribe to it by clicking on the Subscribe button of the Steam Workshop page for your games, which can be found in the Community section of the Steam Client, on the right under the Actions menu. To play other games that are available on the Workshop from other users you must also subscribe to them, and all subscribed games will then appear in the Steam Player, which will update as you subscribe to them to show all the available games.

Updating Your Games


Once you have uploaded your game to the Workshop, you may need to update it or wish to change the screenshot chosen for the description etc... This can be done easily by loading the game into GameMaker:Studio and then choosing the Steam Workshop compile target and hit the Create Executable just as you would when you originally created the game. This time however you should press the button marked "Update Game", which will download all the details of the games you have already uploaded to the Workshop (this may take a few moments depending on the number of games that you have

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 46 de 134

there). The following dialogue will show you the progress: Once all game details have been downloaded the previous "Update Game" button will now show a drop-down list of all of your games. Selecting any one of them will show the previously uploaded screenshot, description and tags which you can then change as you wish. Once finished you should then press the Create button to re-upload the game to the Workshop. Back: The Graphical User Interface (GUI) Copyright YoYo Games Ltd. 2013 All Rights Reserved

Versions
This section lists the differences between versions of GameMaker:Studio
There are a number of different versions of GameMaker:Studio available for you to use, and each one is designed to scale to the level of programming experience of the end-user, either with the GameMaker product or in general. All versions can compile to Windows and MacOSX targets (as well as the Steam Workshop if you have downloaded your version through the Steam client). Apart from these compile targets each available version is different and has a number of limits and restrictions which are detailed below. Should you wish to upgrade your current version of GameMaker:Studio, you can do so through the YoYo Games web site or, if you have the Steam Client, by right clicking on the GameMaker:Studio entry in the Library and selecting "View Downloadable Content".

GameMaker:Studio Free
This version is free to download and use, as it is designed to permit the end-user to test the functions of the product before upgrading to a more powerful version. If you have used previous GameMaker products and are thinking about upgrading to Studio then you can use this version to see the differences between it and previous versions, or if you have never used GameMaker before (or are new to programing) then this version is an excellent place to start. The following limits are present in the Free version of GameMaker:Studio:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 47 de 134

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21.

Limited Rooms 5 Limited Sprites 20 Limited Sounds 10 Limited Objects 15 Limited Backgrounds 5 Limited Timelines 5 Limited Scripts 10 Limited Fonts 5 Limited Paths 10 Limited to 2 shaders Limited Included Files 5 Limited 1 client connection for network functions Limited to TCP only network communication No Configurations No External Resource Loading No Texture Group Control No Extensions No Extra Target Modules No DSP (Developer Services Portal) No Source Control No Steam API integration

GameMaker:Studio Standard
The standard version of GameMaker:Studio removes the limits on game resources and assets, making the product similar to previous versions of GameMaker. This is an ideal starting place for those with some experience in programing or that are comfortable and familiar with the previous versions of the product. The Standard Version of GameMaker:Studio also adds in a new module as part of the bundle permitting you target Windows 8 desktop OS. The following limits are present in the Standard version of GameMaker:Studio: 1. 2. 3. 4. 5. No Configurations No Texture Group Control No Extra Target Modules No DSP (Developer Services Portal) No Source Control

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 48 de 134

6. No Steam API integration

GameMaker:Studio Professional
With the professional version of GameMaker:Studio all limitations are removed and you can experiment with all the features of the program: 1. 2. 3. 4. 5. 6. Configurations for specific clients or builds Texture Group Control for optimising your games and apps Source Control for working in teams using subversion Developer Services Portal integration for in-app purchases, advertising and analytics Android test target for testing your project on Android devices before buying the appropriate target module The possibility of buying extra target modules (currently HTML5, iOS, Ubuntu, Windows Phone and Android)

Back: Contents Copyright YoYo Games Ltd. 2013 All Rights Reserved

Actions
This section of the manual outlines what actions are and how to use them in GameMaker:Studio.
One of the things that makes GameMaker:Studio so unique is the ease with which simple commands and functions can be made to manipulate your game world using actions. These actions come in the form of action sets, with each set having a number of icons that you can drag and drop into an object event to create behaviours for that object (this is commonly called just "DnD", in reference to the drag'n'drop aspect). Here are the action sets in full:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 49 de 134

All the actions are found in the tabbed pages at the right of the object property form, and as you can see there are seven tabs full of actions for you to use to help create your games. If you require a brief reminder of what each action does while working with GameMaker:Studio you can place the mouse over any of them and a short descriptive text will pop up, and for a more in-depth explanation each tab is explained elsewhere in the manual (see the end of this section).

Adding Actions To An Event


To put an action in an event, just drag it from the tabbed pages to the action list in the object as shown in the image below:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 50 de 134

From there you can then edit the details of the action, change the order of actions within the list (by clicking and dragging), copy, paste and even delete actions too. You can also select multiple actions if need be and they can also be dragged or copied from one object's action list to that of another! Now, as you can see above, when you drop an action in the action list, normally a window will pop-up in which you can fill in certain parameters for the action, and you can find a description of each of these actions and parameters in the sections of the manual listed at the end of this page. However,

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 51 de 134

almost all of them have a two things in common which we will deal with here, the first of them being the box at the top that says "Applies To:". This is to tell GameMaker:Studio which instances are to be considered as "running" this action and the default is self, which is the instance of the object that has the action in its action list. Most of the time, this is what you want, but in the case of a collision event, you can also have an action that applies to the other instance involved in the collision, and for that you would change "Applies to:" to other (this is only valid for the collision event). Finally you have object which means that the action will be applied to all instances of a particular object that are active in the current room. In this way you could change all obj_red_balls into obj_blue_balls, for example. The consistent part of most actions is the check-box labeled Relative. When you check this box you are telling GameMaker:Studio that the values you input to the fields of the action are to be relative to the original value rather than being absolute. Here is an image to further explain what this means, and as you will see, checking "relative" can have a big influence on the result of the action!

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 52 de 134

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 53 de 134

Bookmarking Actions
When you add actions to a chosen event, these are numbered down the left hand side of the action list. This is just like when working with code, where each line gets its own line number, and is designed to make debugging and finding your way around complex constructions and action lists. You can "bookmark" a position within the action list too so that with the press of a number key on your keyboard you are taken directly to the action that was previously bookmarked, as long as the object has not been closed (closing the object properties will clear all current bookmarks). To bookmark an action, simply click on it once to select it with the mouse, then press <CONTROL> + <NUMBER> to add a bookmark at that point (The number is from 0 - 9 and is any one of the number keys at the top of your keyboard). It should be noted that the bookmarks are on a "per object" basis, so each object can have ten bookmarks as long as it is open for editing. From the moment you create a bookmark onwards, you can simply press the number key and you will be taken to the action that the bookmark references, and if you wish to remove a bookmark, then you can simply press <CONTROL> + <NUMBER> again which will clear the number specified. This functionality can be switched off in the Scripts Preferences, but note that doing so will also switch off line numbering for code boxes and the script editor. Information on the individual actions found in each set can be found in the following sections: 1. 2. 3. 4. 5. 6. 7. 8. Move Actions Main Actions, Set 1 Main Actions, Set 2 Control Actions Score Actions Extra Actions Draw Actions Using Variables and Expressions in Actions

Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Creating Rooms

Move Actions
The first set of actions consists of those related to the movement of instances.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 54 de 134

The following actions can all be found on the first tab that you see when you open an object and has the label "move". These actions are all related in some way to the movement and position of an instance within the room.

Move
Move Fixed Use this action to start the instance moving in a particular direction. You can indicate the direction using the buttons with the arrows on it. Use the middle button to stop the motion. Also you need to specify the speed of the motion. This speed is given in pixels per step. Preferably don't use negative speeds. You can specify multiple directions. In this case a random choice is made. In this way you can let a monster start moving either left or right. Move Free This is the second way to specify a motion. Here you can indicate a precise direction. This is an angle between 0 and 360 degrees. 0 means to the right. The direction is counter-clockwise. So for example 90 indicates an upward direction. If you want an arbitrary direction, you can type random(360). As you will see below the function random gives a random number smaller than the indicated value. As you might have noticed there is a checkbox labeled Relative. If you check this, the new motion is added to the previous one. For example, if the instance is moving upwards and you add some motion to the left, the new motion will be upwards to the left. Move Towards This action gives a third way to specify a motion. You indicate a position and a speed and the instance starts moving with the speed towards the position. (It won't stop at the position!) For example, if you want a bullet to fly towards the position of the spaceship you can use as position spaceship.x, spaceship.y. (You will learn more about the use of variables like these below.) If you check the Relative box, you specify the position relative to the current position of the instance. (The speed is not taken relatively!) Speed Horizontal The speed of an instance consists of a horizontal part and a vertical part. With this action you can change the horizontal speed. A positive horizontal speed means a motion to the right. A negative one means a motion to the left. The vertical speed will remain the same. Use relative to increase the horizontal speed (or decrease it by providing a negative number).

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 55 de 134

Speed Vertical In a similar way, with this action you can change the vertical speed of the instance. Set Gravity With this action you can create gravity for this particular object. You specify a direction (angle between 0 and 360 degrees) and a speed, and in each step this amount of speed in the given direction is added to the current motion of the object instance. Normally you need a very small speed increment (like 0.01). Typically you want a downward direction (270 degrees). If you check the Relative box you increase the gravity speed. Note that, contrary to real life, different objects can have different gravity directions. Reverse Horizontal With this action you reverse the horizontal motion of the instance. This can for example be used when the object collides with a vertical wall. Reverse Vertical With this action you reverse the vertical motion of the instance. This can for example be used when the object collides with a horizontal wall. Set Friction Friction slows down the instances when they move. You specify the amount of friction. In each step this amount is subtracted from the speed until the speed becomes 0. Normally you want a very small number here (like 0.01).

Jump
Jump to Position Using this action you can place the instance in a particular position. You simply specify the x- and y-coordinate, and the instance is placed with its reference point on that position. If you check the Relative box, the position is relative to the current position of the instance. This action is often used to continuously move an instance. In each step we increment the position a bit.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 56 de 134

Jump to Start This action places the instance back at the position where it was created. Jump to Random This action moves the instance to a random position in the room. Only positions are chosen where the instance does not intersect any solid instance. You can specify the snapping used. If you specify positive values, the coordinates chosen with be integer multiples of the indicated values. This could for example be used to keep the instance aligned with the cells in your game (if any). You can specify a separate horizontal snapping and vertical snapping. Align to Grid With this action you can round the position of the instance to a grid. You can indicate both the horizontal and vertical snapping value (that is, the size of the cells of the grid). This can be very useful to make sure that instances stay on a grid. Wrap Screen With this action you can let an instance wrap around, that is, when it leaves on one side of the room it reappears at the other side. This action is normally used in the Outside event. Note that the instance must have a speed for wrapping to work, cause the direction of wrapping is based on the direction of the motion. You can indicate whether to wrap only horizontal, only vertical, or in both directions. Move to Contact With this action you can move the instance in a given direction until a contact position with an object is reached. If there already is a collision at the current position the instance is not moved. Otherwise, the instance is placed just before a collision occurs. You can specify the direction but also a maximal distance to move. For example, when the instance is falling you can move a maximal distance down until an object is encountered. You can also indicate whether to consider solid object only or all objects. You typically put this action in the collision event to make sure that the instance stops in contact with the other instance involved in the collision. Bounce When you put this action in the collision event with some object, the instance bounces back from this object in a natural way. If you set the parameter

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 57 de 134

precise to false, only horizontal and vertical walls are treated correctly. When you set precise to true also slanted (and even curved) walls are treated correctly. This is though slower. Also you can indicate whether to bounce only against solid objects or against all objects. Please realize that the bounce is not completely accurate because this depends on many properties. But in many situations the effect is good enough.

Paths
Set Path With this action you can specify that the instance should follow a particular path. You indicate the path that must be followed and the speed in pixels per step. When the speed is positive the instance starts at the beginning of the path. If it is negative it starts at the end. Next you specify the end behavior, that is, what should happen when the end of the path is reached. You can choose to stop the motion, restart from the beginning, restart from the current position (which is the same when the path is closed), or reverse the motion. Finally you can indicate that the path must be seen as absolute, that is, the position will be as indicated in the path (this is useful when you have designed the path at a particular place in the room) or relative, in which case the start point of the path is placed at the current location of the instance (end point when speed is negative). See the chapter on paths for more information. End Path Use this action to stop the path for the instance. Path Position With this action you can change the current position of the instance in the path. This must be a value between 0 and 1 (0=beginning, 1=end). Path Speed With this action you can change the speed of the instance on the path. A negative speed moves the instance backwards along the path. Set it to 0 to temporarily stop the motion along the path.

Steps
Step Towards With this action you indicate a position and a speed and the instance starts moving with the speed towards the position. There is also the possibility of

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 58 de 134

assigning an object for this instance to check for while moving, and if any instances of the specified object are encountered along the way, the instance with the action will stop moving. If you check the Relative box, you specify that the x and y position is relative to the current position of the instance (this does not affect the speed). Step Avoid This action is similar to the "Step Towards" action, above. However, with this the instance will not only move towards the specified x and y position at a given speed, it will also actively try to avoid the specified instances that it encounters on the way. The instances to avoid can be either only the ones flagged as "solid" or all instances in general, and in this way you can create a basic type of Ai for your instance. If you check the Relative box, you specify that the x and y position is relative to the current position of the instance (this does not affect the speed). Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Main Actions - Set 1

Main Actions - Set 1


This section deals with some of the main actions you will use when working with GameMaker:Studio.
The main action sets are full of the most important actions that you will need when working with GameMaker:Studio, and the first set, marked "main1" in the object properties tab, deals with instances, sprites, sounds and moving from room to room.

Instances
Create Instance With this action you can create an instance of an object. You specify which object to create and the position for the new instance. If you check the Relative box, the position is relative to the position of the current instance. Creating instances during the game is extremely useful. A space ship can create bullets; a bomb can create an explosion, etc. In many games you will have some controller object that from time to time creates monsters or other objects. For the newly created instance the creation event is executed.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 59 de 134

Create Moving This action works the same as the action above but with two additional fields. You can now also specify the speed and direction of the newly created instance. Note that if you check the Relative box, only the position is relative, not the speed and direction. For example, to make a bullet move in the direction of the person shooting you have to use a little trick. As position use 0,0 and check Relative. As direction we need the current direction of the instance. This can be obtained by typing in the word direction. (This actually is a variable that always indicates the current direction in which the instance is moving.) Create Random This action lets you create an instance of one out of four objects. You specify the four objects and the position. An instance of one of these four objects is created at the given position. If you check the Relative box, the position is relative to the position of the current instance. If you need a choice out of less than four objects you can use No Object for some of them. This is for example useful to generate a random enemy at a location. Change Instance With this action you can change the current instance into an instance of another object. So for example, you can change an instance of a bomb into an explosion. All settings, such as the motion and the value of variables, will stay the same. You can indicate whether or not to perform the destroy event for the current object and the creation event for the new object. Destroy Instance With this action you destroy the current instance. The destroy event for the instance is executed. Destroy at Position With this action you destroy all instances whose bounding box contains a given position. This is useful, for example, when you use an exploding bomb. When you check the Relative box the position is taken relative to the position of the current instance.

Sprites
Change Sprite

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 60 de 134

Use this action to change the sprite for the instance. You indicate which new sprite. You can also indicate with subimage must be shown. Normally you would use 0 for this (the first subimage) unless you want to see a particular subimage. Use -1 if you do not want to change the current subimage shown. Finally you change the speed of the animation of the subimages. If you only want to see a particular subimage, set the speed to 0. If the speed is larger than one subimages will be skipped. If it is smaller than 1 subimages will be shown multiple times. Don't use a negative speed. Changing sprites is an important feature. For example, often you want to change the sprite of a character depending on the direction in which it walks. This can be achieved by making different sprites for each of the (four) directions. Within the keyboard events for the arrow keys you set the direction of motion and the sprite. Transform Sprite Use this action to change the size and orientation of the sprite for the instance. Use the scale factors to make it larger or smaller. The angle gives the counter-clockwise orientation of the sprite. For example, to make the sprite oriented in the direction of motion use as a value direction. For example, this is useful for a car. You can also indicate whether the sprite should be mirrored horizontally and/or flipped vertically. Color Sprite Normally the sprite is drawn as it is defined. Using this action you can change the color of the sprite. This color is blended with the sprite, that is, it is combined with the colors of the sprite. If you want to draw a sprite in different colors you better define the sprite in black and white and use the blend color to set the actual color. You can also indicate an alpha transparency. With a value of 1 the sprite is opaque. With a value of 0 it is completely transparent. With a value in between you will partially see the background shine through it. This is great for making explosions.

Sounds
Play Sound With this action you play one of the sound resources you added to your game. You can select the sound you want to play and choose whether it should play only once (the default) or loop continuously. Multiple wave sounds can play at once but only one midi sound can play at a time. So if you start a midi sound, the current midi sound is stopped. Stop Sound This action stops the indicated sound. If multiple instances of this sound are playing all are stopped.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 61 de 134

Check Sound If the indicated sound is playing the next action is performed. Otherwise it is skipped. You can select Not to indicate that the next action should be performed if the indicated sound is not playing. For example, you can check whether some background music is playing and, if not, start some new background music. Note that this action returns true when the sound actually plays through the speakers. After you call the action to play a sound it does not immediately reach the speakers so the action might still return false for a while. Similar, when the sound is stopped you still hear it for a while (e.g. because of echo) and the action will still return true.

Rooms
Previous Room Move to the previous room, as defined by the order of the room assets in the resource tree. If you are in the first room of the game and call this function you will get an error. Next Room Move to the next room, as defined by the order of the room assets in the resource tree. If you are in the last room of the game and call this function you will get an error. Restart Room This will restart the current room. Different Room With this action you can go to a particular room, selecting the room to go to from the drop-down list. Check Previous This action tests whether the previous room exists. If so, the next action is executed.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 62 de 134

Check Next This action tests whether the next room exists. If so, the next action is executed. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Main Actions - Set 2

Main Actions - Set 2


This section deals with some of the main actions you will use when working with GameMaker:Studio.
The main action sets are full of the most important actions that you will need when working with GameMaker:Studio, and the second set, marked "main2" in the object properties tab, deals with timing, showing information, game control and resource control.

Timing
Set Alarm With this action you can set one of the twelve alarm clocks for the instance. You select the number of steps and the alarm clock. After the indicated number of steps, the instance will receive the corresponding alarm event. You can also increase or decrease the value by checking the Relative box. If you set the alarm clock to a value less than or equal to 0 you switch it off, so the event is not generated. NOTE: An alarm with no actions in it will not run. However, even with just a comment and no code, the alarm will count down. Set Time Line With this action you set the particular time line for an instance of an object. You indicate the time line and the starting position within the time line (0 is the beginning). Also you indicate whether the time line should start immediately and whether it should loop at the end. Time Line Position

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 63 de 134

With this action you can change the position in the current time line (either absolute or relative). This can be used to skip certain parts of the time line or to repeat certain parts. Time Line Speed With this action you can change the speed of the time line (either absolute or relative). A speed of 1 is the normal speed. When you e.g. set it to 2 the actions will happen twice as fast and when you set it to 0.5 twice as slow. You can also set a negative speed, in which case the time line is played backwards. Start Time Line This action starts the time line from its current position (if it is paused or stopped). Pause Time Line This action pauses the time line. Use the start action to let it continue. Stop Time Line This action stops the time line and sets the position back to 0.

Info
Display Message With this action you can display a message in a dialog box. You simply type in the message. If you use a # symbol in the message text it will be interpreted as a new line character. (Use \# to get the # symbol itself.) If the message text starts with a quote or double quote symbol, it is interpreted as an expression. See below for more information about expressions. URL Open With this action you can tell your game to open a web page. You need to specify the complete URL for this to work.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 64 de 134

Game
Restart Game With this action you restart the game from the beginning. End Game With this action you end the game. NOTE: If the target module for your game is HTML5, this function will end the game but will not close the tab or browser. WARNING: If the target module for your game is iOS or Windows Phone then this action may block your device, and as such it is strongly recommended that you do not use it for that platform except as a dev tool. Your final game will also be rejected if this action is used when submitting to the respective app store. Save Game With this action you can save the current game status. You specify the filename for saving (the file is created in the working directory for the game). Later the game can be loaded with the next action. (Please realize that only the basic game status is save. Things that are for example not saved are the current sound that is playing, and advanced aspects like the contents of data structures, particles, etc.) Load Game Load the game status from a file. You specify the file name. Make sure the saved game is for the same game and created with the same version of GameMaker. Otherwise an error will occur. (To be precise, the game is loaded at the end of the current step. So some actions after this one are still executed in the current game, not the loaded one!)

Resources
Replace Sprite This action can be used to replace a sprite from the contents of a file. You indicate the sprite you want to replace, the filename and the number of

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 65 de 134

subimages in the sprite. Many different images file formats are supported, e.g. .png, .jpg, .tif, and .gif. For a gif file the number of subimages is automatically decided based on the number of subimages in the gif file. Other settings for the sprite, e.g. whether it is transparent or not, are not changed. You can use this action to avoid storing all sprites in the program itself. For example, at the beginning of a level you can replace sprites by the actual character sprites you want to use. DON'T change a sprite that is at that moment being used in an instance in the room. This might give unwanted effects with collisions. Replace Sound With this action you can replace a sound by the contents of a file (.wav, .mid, or .mp3). You specify the sound and the filename. This avoids having to store all the sounds in the game itself. For example, you can use different pieces of background music and pick the one you want to play. DON'T change a sound while it is playing. Replace Background With this action you can replace a background by the contents of a file. Many different images file formats are supported, e.g. .png, .jpg, .tif, and .gif. You specify the background and the filename. This avoids having to store all the backgrounds in the game itself. DON'T change a background that is visible. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Control Actions

Control Actions
The control actions are actions which ask questions, add code or check conditions.
The third tab in your object properties action list is the "control" tab. This tab has all the main actions that are needed to control the more complex workings of your game like asking questions, checking conditions or adding GML code. These actions are generally used in groups as outlined in the

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 66 de 134

following image: In the above example, the actions check to see if a position is collision free and if it returns true (there is no collision) then a "code block" is opened and in that we have another two actions. These two actions work together, with the first one generating a random 1 in 2 chance of running the second action, which will create an instance of "obj_Enemy" and then the code block is closed. However, should the very first action that checks for a collision return false (there is a collision), then the second code block is started after the "else", and this block bursts some particles and plays a sound. Note that the code blocks are indented as this gives a better overview of the actions, in particular when you use blocks inside blocks for more and more complex programs.

Questions
The following actions are dealing with conditional checks (ie: questions) which are normally to see if something exists, or if there is a collision, or if two values are the same as each other (or greater, or less). For all conditionals there is a check box labeled NOT. If you check this, the result of the question is reversed so that if the result was true it becomes false and if it was false, it becomes true. If you look at the action "Check Empty", you can

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 67 de 134

have it without checking the "NOT" box, which means it is asking "if the place that I put the instance is empty", but if you have "NOT" checked then you are asking "if the place that I put the instance is not empty". This allows you to perform certain actions when a question is not true, or not equal to or even not greater or not less than! Another thing to watch when dealing with these conditionals is that you can indicate whether they should apply to all instances of a particular object or not. If you choose to apply them to all instances of an object, the result will be true (or whatever) only if it is the same for all instances of that object. For example, you can check all instances of an object to see if the position slightly to the right is collision free. Check Empty This question returns true if the current instance, placed at the indicated position does not generate a collision with an object. You can specify the position as either absolute or relative and you can also indicate whether only those instances flagged as solid should be taken into account or all instances. This action is typically used to check whether the instance can move to a particular position. Note: This action requires that the instance doing the check has a mask index or a sprite with a valid collision mask assigned to it. Check Collision This is the opposite of the previous action. It returns true if there is a collision when the current instance is placed at the given position and, again, you can choose to check for only those instances flagged as being solid or all instances. Note: This action requires that the instance doing the check has a mask index or a sprite with a valid collision mask assigned to it. Check Object This question returns true if the instance placed at the indicate position meets an instance of the indicated object. These collisions will be precise if both instances have the mask index or sprite mask defined as being precise otherwise they will be based on whether their bounding box overlaps or not. Note: This action requires that both the instance doing the check and the instance being checked has a mask index or a sprite with a valid collision mask assigned to it. Test Instance Count For his action you specify an object and a number. If the current number of instances of the object is equal to the number the question returns true, otherwise it returns false. You can also change the check to test whether the number of instances is greater than or less than the value you input. This type of check is typically used to check whether all instances of a particular type are gone, and so influence things like score, health or the game state.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 68 de 134

Test Chance This action takes the result of a "one in X" chance, where "X" is the number you input to test. For example, if you set the number to 20, then it's as if you have rolled a 20 sided dice and only if the side numbered 1 comes up will you get a "true" result, and the action will perform the next one below it. The larger the number of "sides" of the dice, the smaller the chance of 1 being true and the next action being carried out, and the number being checked doesn't actually have to be an integer as you could check for a 1 in 2.5 chance, or a 1 in 35.75 chance etc... However, fractions of 1 will not work as you can't have a 1 in 0.5 chance of something happening! This has many, many uses when making games as it can add a controlled, yet random chance of something happening, for example in each step you could have a bomb check to see if it should explode, or an enemy check to see if it should change direction. Check Question Here you can specify a question for the player to answer either yes or no to, with the subsequent actions running (or block of actions) if the result is yes (true). The question is shown in an independent pop-up dialogue. Test Expression This is the most general question action whereby you can enter an arbitrary expression and evaluate it. If the expression evaluates to true (that is, a number larger or equal to 0.5) then the next action (or block of actions) is performed. For more information on expressions see this section of the manual - Using Expressions and Variables in Actions. Check Mouse This action will return true if the indicated mouse button is pressed. For example, in the step event of an object you can check whether a mouse button is pressed and, if so, move the instance to that position (you would use the jump to a point action with values mouse_x and mouse_y). Check Grid Returns true if the position of the instance lies on an imaginary grid, made up of spaces defined by you in action when you add values to the vertical and horizontal spacing parameters. A common use for this action is to do a check and only let the player move if his character is aligned to the grid (think how a game like PacMan works).

Other

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 69 de 134

Start Block This indicates the start of a block of actions. Using the start and end block markers you are able to group a series of actions together so that if a conditional results as true, then all the actions are performed and not just the one directly below the question. the following image illustrates this:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 70 de 134

End Block

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 71 de 134

Indicates the end of a block of actions. See the above image and "Start Block" action for more information. Else When you ask a question you may often wish to have a reply for if the answer is true or false, and so GameMaker:Studio provides you with the "else" action so you can re-create this with actions. Basically, you have your conditional, then the block of actions if it is true, then "else", then the block of actions for if it is false. See the image at the top of the page for an example of how this looks. Repeat Another useful action is the "Repeat" action. With this action, all you do is specify the number of times you wish the next action (or block of actions) to repeat and it will be done without you having to copy and paste the actions yourself many times over. This can be used for many things, for example spawning number of pickup objects, or adding a value many times onto another or any manner of things. Exit Event When this action is encountered no further actions in this event are executed. Call Parent Event This action is only useful when the object has a parent object as it calls the corresponding event in the parent object. When working with parents, any event that the parent object shares with the child object is over-ridden by the child, so you can call this action to force the child object to run the parent objects event as well as any actions it has for the event.

Code
If you want more control over what is happening in the game you can use code as GameMaker:Studio has its own language called GML (The GameMaker Language). This can give far more flexibility than using the standard DnD actions as it covers far more things , but code and actions are not mutually exclusive and can be mixed in events to get the behaviours you require. Execute Code When you add this action, a window will open showing the GM Script Editor where you can write the code that you wish the event to execute. This code can be for anything from a single simple function to a full blown AI, however it is recommended that you use scripts (see Advanced Use: Scripts)

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 72 de 134

for longer pieces of code as it makes structuring your game far easier. Execute Script With this action you can execute a script that you have previously added to the game resources, passing a maximum of five arguments to it. For more information on scripts you can go to this section of the manual - Advanced Use: Scripts. Comment Use this action to add a line of comment to the action list. A comment is usually a short sentence to remind you of what a particular set of actions is meant to do and a comment in itself does not actually affect the normal running of GameMaker:Studio. However, even though it does nothing, it is still recognised as an action and can be (for example) placed in a collision event so that it will trigger that collision even when no code is present.

Variables
Variables are an essential part of game making. They are the base on which almost all a game is built as you need them to hold the values that govern the behaviour of your objects, for example, score, lives and health are all internal variables that GameMaker:Studio creates for you (see Variables And Variable Scope). However, in-built variables are certainly not enough to build your game around, and so you will need to use the following actions (or code) to set, test and change variables as your game progresses. Set Variable This action sets a variable to a value. If that variable does not exists then it creates it and gives it the specified value. This action can also change the many in-built variables that GameMaker:Studio has. To use it you specify the name of the variable and the new value it should have. Bear in mind that when you check the Relative box, the value is added to the current value of the variable, but please note that this can only be done if the variable has already been created and has had a value assigned to it! Test Variable With this action you can check what the value of a particular variable is. If the value of the variable is equal to the number you have provided then the question returns true, otherwise it returns false. You can also indicate that the check should be whether the value is smaller than or greater than the value specified and you can even use this action also to compare two expressions or variables to see if they are the same as, greater than or equal to each other.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 73 de 134

Draw Variable With this action you can draw the value of a variable at a particular position on the screen. Note that this can only be used in the draw event of an object. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Score Actions

Score Actions
The score actions are actions which deal with things related to score, lives and health.
In most games there is a score of some type and the player will usually have either health or lives (or both). Now, you can use the variable and question actions to set this up yourself, but GameMaker:Studio comes with a series of in-built variables that deal with these things, and these variables have their corresponding actions, which are detailed in this section.

Score
Set Score With this action you can set the score to a value of your choice. Note that "score" is a global variable (see this section for more information: Variables And Variable Scope) and as such, this action can be placed in any object, meaning that (for example) you could have a destroy event for an enemy object that sets the score to 10 relative. Why relative? Well, as outlined in the introduction to actions, this will add 10 to the current score whereas if you do not check the relative flag it will just set the score to 10! You would normally un-check the relative flag and place this action at the start of a game to set the score to 0, for instance. Test Score This action will check the value of the score against the value you input and return true if it meets the condition. The condition can be either equal to, greater than or less than and in this way you can have specific behaviours for an instance depending on the current value of the score variable.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 74 de 134

Draw Score You can use this action to draw the score variable anywhere on the screen, just provide the position and the caption to be shown beside the value. Please note that this action will only be valid when used in the Draw Event. Clear Highscore With this action you are telling GameMaker:Studio to clear the high score table. Warning! This cannot be undone!

Lives
Set Lives Another global variable included with GameMaker:Studio is the one for lives (for more information on global variables see: Variables And Variable Scope). Normally you would set it to some value like 3 at the beginning of the game and then decrease or increase the number depending on what happens as the player progresses. Don't forget to check the Relative box if you want to add or subtract from the number of lives. At the moment the number of lives becomes 0 (or less than 0) a "no more lives" event is generated. Test Lives With this question action you can check whether the number of lives has reached a particular value. You indicate the value and whether the number of lives should be equal to, be smaller than, or be larger than the value. This can be used, for example, to limit the lives that a player can pickup while playing a game and so keep them from going above a maximum value. Draw Lives You can use this action to draw the number of lives directly to the screen. You provide the position and the caption that must be placed in front of the number of lives, and then number of lives is drawn in the current font. Please note that this action will only be valid when used in the Draw Event. Draw Life Images Many games prefer to represent lives with some sort of graphic rather than straight text, and so GameMaker:Studio provides this action so you can get the same effect. You specify the position and the sprite image to be used for each life and at the indicated position the number of lives is drawn as

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 75 de 134

images. Please note that this action will only be valid when used in the Draw Event.

Health
Set Health GameMaker includes a built-in health global variable (for more information on global variables see: Variables And Variable Scope), and like the previous actions for score and lives, you can use this action to set and change the health value. To set the health to a specific value, leave the "relative" flag un-checked, but if you wish to add or subtract from the health value, then make sure that it is checked. Please note that this variable is clamped to be within the range of 0 to 100 (where 0 is no health and 100 is full health) and that when the health becomes less than or equal to 0 an "out of health" event is generated. Test Health With this question action you can check whether the health has reached a particular value. You indicate the value and whether the health should be equal to, less than or greater than the value. One use for this is that when the player health gets below a certain amount you could make some object flash to draw their attention to the fact. Draw Health We have all seen a players health drawn in the game in the form of a bar that increases or decreases as the status of the player changes, well, this action permits you to draw the health variable in this way too. When the health is at 100 the full bar is drawn and when it is at 0 the bar is empty, and you can indicate the position and size of the health bar as well as the color of the bar and its background. Score Caption Normally in the window caption the name of the room and the score is displayed, but with this action you can change this to show the score, lives, health and what the caption for each of these must be, or not, as you wish. This functionality is only valid for Windows, Ubuntu (Linux) and MacOS targets. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Extra Actions

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 76 de 134

Extra Actions
This tab contains a few extra actions to help create effects for your game.
The extras tab is dedicated mainly to the creation and use of Particles in your game, but there is one other action at the bottom which we will describe first before going into a bit more depth about particles.

Other Actions
Set Mouse Cursor This function allows you to set the cursor for the game to a sprite that you can choose from the resource tree. You are also given the option to hide the standard mouse cursor as well. This functionality is only valid for Windows, Linux (Ubuntu), MacOS and HTML5 targets.

Particles
Now, above that one we have a whole host of actions related to creating particle systems, types and emitters... but, what is a particle? Basically, a particle is a graphics resource which is created with a base set of properties set by you beforehand. Unlike objects, backgrounds and tiles, once a particle has been created you no longer have any control over it and it will continue to exists until it reaches the end of its "life", which is defined by you using these actions. You can also define its color, speed, direction and if it will be affected by gravity or not, as well as how many of them you want to be created and how often. As particles are purely graphical, they are also very fast to process and you can have lots of them on screen at any one time with no noticeable lag, making them ideal for many special effects, like smoke trails, blood splatters and debris. Below you can find a list of all the actions available to create a particle system and define types and emitters.

Particle System Create Before you can create any particles, you have to create the "system" that they are created in. This action will create that system and ask you for the depth that any particles you create will be drawn at. As with objects and tiles, this depth can be a positive or a negative integer, with a high negative value placing it "above" other things and a high positive value placing it "below".

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 77 de 134

Particle System Destroy Particle systems take up memory space and if they are not managed properly, they can slow down and even crash your game. To prevent this you must destroy them when not in use with this action. Normally it would go in the destroy event of the object that has the Particle System Create action, or in the room end event if there is nothing going to destroy it sooner (or even both events). Particle System Clear This action will clear a system of all particles in it making all those that are visible on the screen disappear. This does not destroy the particle system, nor the particles and emitters, it only clears the screen until more particles are emitted. Particle Type Create Before you can see any particles in a system, they have to be created and defined, first with this action, and then (if necessary) with the other actions listed below. In this action you are able to specify the name of the particle (type0 - type15), and choose whether to use your own custom sprite or one of

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 78 de 134

the included particles which are shown in the image below: You then have the options "min size" and "max size" which enable you to set a minimum and a maximum initial size for your particle. All this means is that your particles will be created a random size within these limits that you set and if you want them all to be the same size then set both parameters to the same value. Finally there is the "size increment" option which enables you to specify whether you wish a particle to grow (positive number) or shrink (negative number) after it has been created on the screen. Normally this value is kept pretty low, 0.1 or -0.05 for example. Particle Color With this action you can set the colors of the particles as well as the alpha (transparency, with 1 being fully opaque and 0 being fully transparent) and how the colors are to be used, either fading over the life of the particle from color1 to color2 (changing) or having each particle choose a permanent color from those specified (mixed). Note that "alpha" has a start and end value so you can make particles fade out or in over their lifetime on the screen. Particle Life The lifetime of a particle is the time it takes, in steps, from the moment it is created to the moment it disappears from the screen. With this action you specify the particle and a minimum and maximum lifetime or your particles, with each individual particle having a life somewhere within that range. If

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 79 de 134

you wish them all to have the same lifetime then set both values to be the same. Particle Speed This action not only sets the speed of the particle but also its direction and whether or not it is affected by friction (causing it to slowdown over time). As with all other particle actions, you must first select a particle type for the action to work on and then set the maximum and minimum speeds for the particles to be created with. Finally you set a directional range too, based on the standard GameMaker:Studio angles system, with 0 being right, 90 up, 180 left and 270 down and you can also set the friction for your particle (normally a small value like 0.05). Particle Gravity Particles can be affected by gravity too, so with this action you can select the particle type it has to affect and also the amount and the direction that it should "pull". The direction is based on the standard GameMaker:Studio angles system, with 0 being right, 90 up, 180 left and 270 down. Particle Secondary This action allows you to tell a particle to emit other particles at different times. The options are outlined below:

type id: The type name of the initial particle that will have this action. step type: This is the type name of the particle you wish to emit each step if the option below is greater than 0. Normally this is a different particle to that specified in the "type id" above. step count: This is the number of particles to emit every step of the lifetime of the initial particle. death type: This is the type name of the particle you wish to emit when the initial particle defined in the "type id" parameter reaches the end of its lifetime. This is only effective if the option below is greater than 0, and normally this is a different particle to that specified in the "type id". death count: This is the number of particles (whose type is defined by the above parameter) that are to be emitted when the initial particle reaches the end of its lifetime. Create Emitter

Once you have created your particle you will want to see it in the room, and when using actions the only way to do that is to use an emitter. An emitter is just another part of the particle system whose sole purpose is to emit particles based on the parameters that you have defined for it. These parameters are the name (id) of the emitter, the shape of the emitter (an ellipse or a rectangle) and the coordinates within the room of the emitter. The coordinates are defined by four parameters, and xmin and an xmax, and a ymin and a ymax, so for example, if you want to emit particles over your whole room you would have the xmin equal 0, the xmax equal the room width and the ymin equal 0 and the ymax equal the room height.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 80 de 134

Destroy Emitter Like other things in a particle system, emitters take up memory and when one is no longer needed it should be destroyed using this action. Burst From Emitter Particles can be either burst or streamed from an emitter, which means that they are all created at once (burst) or they are created over a set number of steps (streamed). This action controls the bursting of particles and should be placed in any event where you need to create a group of particles at once (like in a mouse button event, for example). You choose the emitter to use, the particle type to burst and the number of those particles that should be emitted. Note too that you can use a negative number for the amount of particles to burst, which means that, for example, if you have a value of -10 then there is a one in ten chance that a particle will be emitted. Stream From Emitter Particles can be either burst or streamed from an emitter, which means that they are all created at once (burst) or they are created over a set number of steps (streamed). This action controls the streaming of particles and should only normally be used once in any instance. You choose the emitter to use, the particle type to stream and the number of those particles that should be emitted every step of the game while the emitter exists. Note too that you can use a negative number for the amount of particles to stream, which means that, for example, if you have a value of -10 then there is a one in ten chance that a particle will be emitted each step. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Draw Actions

Draw Actions
The draw actions are actions which draw things to the screen.
The following actions are all related to the act of drawing things to the screen. As such, most of them can only be used in the draw event of an object, and even then they will not be performed if the object has been flagged as invisible through code or through the object properties "visible" setting being un-checked.

Drawing

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 81 de 134

Draw Self When you add any type of action or code to the draw event of an object, you are telling GameMaker:Studio that you are taking over the draw event and that you will tell it what to draw from now on. This means that any assigned sprite will no longer be drawn unless you explicitly say so, which when you would use this action. This simply draws the assigned sprite for the object with any transforms that may have been set in previous events (like scaling, blending or changes in alpha) at the current sub-image. Draw Sprite This will draw a sprite somewhere in the room. You specify the sprite, the position (either absolute or relative to the current instance position) and the subimage of the sprite (The subimages are numbered from 0 upwards). If you have an animated sprite and you want it to draw the subimages as normal, use number -1. This action will not draw the sprite transformed, even if you have changed the image blend or scale. Draw Background This will draw a background resource somewhere within the room. You indicate the background image, the position (absolute or relative) and whether the image should be tiled all over the room or not. Draw Text With this action you can draw text anywhere in the room. You specify the text and the position to draw, but please note that there are certain conventions to follow when drawing text:

A # symbol in the text is interpreted as going to a new line, so typing this - Hello world!#Nice day - would draw the text over two lines. If you need to draw the # symbol itself, use \# ie - this is foobar \#3. You can mix text and expressions to draw values of variables. The text you want to draw must be in quotes (either ' or ") and the variable to draw must use the string() function. For example, if you wish to draw the value of the in-built object variable direction, you would have this - 'Current Direction = ' + string(direction)

Draw Scaled Text This action is similar to the previous action but this time you can also specify a horizontal and vertical scaling factor to change the size of the text and

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 82 de 134

you can also specify an angle to rotate it. Draw Rectangle You specify the coordinates of the two opposite corners of the rectangle, either absolute or relative to the current instance position, and you can tell GameMaker:Studio to draw either a solid filled rectangle, or just the outline. The color of the rectangle depends on the currently selected draw color (see the Set Color action below). Horizontal Gradient This action also draws a rectangle but this time using a color gradient that changes from left to right. You can specify the size and position of the rectangle, either absolute or relative to the current instance position, and the two colors to use in the gradient. Vertical Gradient This action also draws a rectangle but this time using a color gradient that changes from top to bottom. You can specify the size and position of the rectangle, either absolute or relative to the current instance position, and the two colors to use in the gradient. Draw Ellipse With this action you can draw an ellipse. You specify the coordinates of the two opposite corners of the rectangle that would border the ellipse, either absolute or relative to the current instance position, and you can tell GameMaker:Studio to draw either a solid filled ellipse, or just the outline. The color of the ellipse depends on the currently selected draw color (see the Set Color action below). Gradient Ellipse As above, you draw an ellipse, but this time you can select a gradient of two colors to fill it from the center out to the border. Draw Line This simply draws a line between the two points that you specify in the action, either absolute or relative to the current instance position. The color of the line depends on the currently selected draw color (see the Set Color action below).

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 83 de 134

Draw Arrow With this action you can draw a simple arrow. Much like the Draw Line action, you specify the coordinates of the two endpoints of the arrow, either absolute or relative to the current instance position, and the size of the arrow tip. The size is in pixels and is measured backwards from the end of the line, so that the point of the arrow adds nothing to the overall length. The color of the line depends on the currently selected draw color (see the Set Color action below).

Settings
The following actions do not need to be called from the draw event, and are usually only called once in a specific event (like the create event or a mouse event) due to the fact that they only need to set their action once in a game. Set Color Lets you set the color used for drawing shapes, lines, and text. This does not influence in any way sprites and backgrounds are drawn. Set Font You can set the font that is from this moment on used for drawing text, but this must be one of the font resources you have defined previously in the resource tree. If you choose No Font a default 12 point Arial font is used. Set Full Screen With this action you can change the screen mode from windowed to fullscreen and back. You can indicate whether to toggle the mode or whether to go to windowed or fullscreen mode, making it an ideal action for use in any kind of options menu for your game.

Other
The following actions do not need to be called from the draw event. Take Snapshot With this action you can take a snapshot image of the game while it is being played and store it in a .png file, the name of which you specify in the

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 84 de 134

action. Create Effect With this action you can create all sorts of basic effects in a very simple way. You specify the type of effect, e.g. an explosion or smoke, its position, its size and its color and whether it should be shown below the objects (at a depth of 100000) or on top of them (at a depth of -100000). The rest is done automatically for you by the in-built GameMaker:Studio particle system (for more information on particles see - Extra Actions and Reference: Particles). Note that for rain and snow the position is irrelevant as it always falls down from the top of the screen and that to get continuous rain you should create it in each step. Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Using Expressions And Variables In Actions

Using Expressions And Variables In Actions


This section covers how to use expressions and the in-built instance variables in actions.
When using many of the actions in GameMaker:Studio you are expected to input a value as one of the parameters, but sometimes that is not enough and you may find it necessary to input a formula or an expression to get the required result from the action. this is perfectly valid and GameMaker:Studio permits the use of any of the in-built instance variables, constants or global variables as well as the use of your own (previously defined) variables and even mathematical formula! The image below shows how this can work:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 85 de 134

As mentioned before, GameMaker:Studio also has a great number of in-built variables that are unique to each and every instance created in a room. These instance variables are created for you automatically when you create an object and can be used, set and changed just as you would any other variable. Below is a list of all these variables: 1. x: the x-coordinate of the instance in the room. Changing this will position the instance elsewhere in the room along the x-axis. 2. y: the y-coordinate of the instance in the room. Changing this will position the instance elsewhere in the room along the y-axis. 3. hspeed: the horizontal speed (in pixels per step) at which the instance is moving. A positive value means movement to the right and a negative value means movement to the left.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 86 de 134

4. vspeed: the vertical speed (in pixels per step) at which the instance is moving. A positive value means movement to the bottom and a negative value means movement to the top. 5. direction: the current direction of motion in degrees (0-360), where 0 is right, 90 is up, 180 is left and 270 is down. 6. speed: the current speed of motion in the current direction. For a "forward" motion (ie: facing the direction) this is a positive value, and for a "backwards" motion it should be negative. 7. visible: this is the flag that sets an object as being visible (the draw event is performed) or invisible (the draw event is skipped). 8. image_index: this variable indicates which subimage in the current sprite is currently shown. When the animation speed (image_speed, see below) is set to a value greater than 0, this variable changes each step to reflect the sub-image being shown of the animation . 9. image_speed this variable indicates the speed with which the subimages are shown, with the default value being 1 (meaning 1 frame per step). If you make this value larger than 1 some subimages are skipped to make the animation faster, and conversely, if you make it lower than 1, then some sub-images are repeated over various steps to make it animate slower. 10. id: the unique identifier (an integer) of the instance. This value is assigned to the instance when it is created and cannot be changed. 11. object_index: this is the index (not the name) of the object that the instance has been created from. This value is assigned to the instance when it is created and cannot be changed. Further information on in-built instance variables can be found in the following sections: 1. Reference: Movement Variables 2. Reference: Instance Variables 3. Reference: Physics Variables Apart from the in-built instance variables, we also have a number of global variables that can be used in actions too (see Variables And Variable Scope for more information on global variables). Here are a few of those available: 1. 2. 3. 4. score: the current value of the score lives: the current number of lives health: the current health (0-100) mouse_x: x-position of the mouse

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 87 de 134

5. mouse_y: y-position of the mouse Back: Actions Copyright YoYo Games Ltd. 2013 All Rights Reserved

The Drop Down Menus


This section lists the various menus that are in the GUI.
At the very top of the GUI you will find the drop down menus. As there are a number of them and each has its own selection of options, you can find out more about them from the pages listed below: 1. 2. 3. 4. 5. 6. 7. The File Menu The Edit Menu The Resources Menu The Scripts Menu The Run Menu The Window Menu The Help Menu

Back: The Graphical User Interface (GUI) Copyright YoYo Games Ltd. 2013 All Rights Reserved

The Edit Menu


Here you can find out all about the various options available to you from the drop down edit menu.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 88 de 134

The edit menu contains a number of commands that relate to the resource currently selected from the resource tree on the left of the main screen (object, sprite, sound, etc.). Depending on the type of resource selected, some of the commands may not be visible.

Insert...: inserts a new resource of the type currently selected. A form will then open in which you can change the properties of that resource (more on this in the following sections of the manual) Duplicate: This makes a copy of the currently selected resource in the resource tree. The new resource is given a default name and a form is opened in which you can change the properties of that resource. Insert Group: Inserts a sub-folder within the resource tree. This is useful for grouping objects and things of the same type together for easy referencing. Delete: Deletes the currently selected resource (or group of resources) from the resource tree. Be very careful with this as it cannot be undone. You will be warned before the operation is completed and given the option to cancel or go ahead. It should also be noted that depending on the preferences you have selected for GameMaker:Studio these resources may also be removed from the harddrive. Rename: Gives the resource a new name. This can also be done in the property form for the resource, by right-clicking the resource with the mouse (windows version) and selecting "rename" from the pop-up menu, or by simply clicking the resource again and typing in the new name.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 89 de 134

Properties: All resources have a properties form that can be brought up by selecting this command. Note that all the property forms appear within the main window and you can have open and edit many of them at the same time. You can also call up the properties by double clicking on the resource. Find Resource: This searches through the resource tree looking for the name of the resource that you request. This is very handy when you have a large project with many resources in grouped sub-folders. Expand Resource Tree: Each section (and sub-folder within) of the resource tree can be collapsed when not in use to allow more space on screen for other resources. Click on this to expand them again. Collapse Resource Tree: . Similar to the above, this command collapses a resource tree section or sub-folder. Show Object Information: It is sometimes necessary to see all the details of an object and its properties in one place, and this can be achieved by selecting this command. It can be a very useful feature for debugging and getting an overview of any object. Transparent Background Settings: Here you can indicate how the transparent area of the sprite and background resources should be shown in the sprite editor. You can either use a customizable block pattern, or a solid fill color which you can change by clicking on the color selector box.

Note that many of these commands can also be given by right-clicking on a resource (or a resource group), and then using the appropriate action from the pop-up menu. Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: The Resources Menu

The File Menu


Here you can find out all about the various options available to you from the drop down file menu.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 90 de 134

In the file menu you can find the commands you'd expect for loading and saving files, but there are also a few special ones:

New: Choose this command to start creating a new game from scratch. If the current game has changed you are asked whether you want to save it before proceeding. There is also a tool-bar button for this command, but both will methods will take you back to the "Welcome" screen where you can create a new project. Open: Opens a GameMaker:Studio game file with the extension *.gmx. Import: Imports a GameMaker:Studio *.gmz compressed file (which will then be saved as a standard *.gmx) game file. You can also select to import Legacy GameMaker files with the extensions gm81, gmk, gm6 or gb1...n files from here. These might not work correctly in this new version due to changes in GameMaker over the years, and as such it is recommended that you check out the YoYo Knowledge Base to see what's changed between versions before deciding to import legacy files. There is also a tool-bar button for this command and you can even open a game by dragging the file into the actual GameMaker:Studio window. Recent Files: Use this sub-menu to open game files you have recently opened or modified. Save: Saves the game project file under its current name with the *.gmx extension. If no name was specified before, you are asked for a new name. You can only use this command when the file has been changed and, again, there is a tool-bar button for this. Saving with this command will only save those things that have been changed since the file was opened. Save As: Saves the current game project file under a different name. You are asked for a new name before saving. Save All: Saves the game project file under its current name with the *.gmx extension. If no name was specified before, you are

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 91 de 134

asked for a new name. Unlike the regular "Save" command, this will export and save all the game information, whether it has changed or not. Export Project: Exports your project as a compressed GameMaker file with the format *.gmz. These project files contain all the information relevant to your current project (including resources, extensions, game information etc...) which can then be imported again into GameMaker:Studio as a complete project in the future. This is very useful for transferring a project over a network as well as for storing shelved projects or backup copies of a current project. Create Application: Once your game is ready you will probably want to give it to others to play! By using this command you create a stand-alone version of your game. The actual files produced will depend on the target module chosen in the drop down menu of the GameMaker:Studio GUI. Preferences: This will open the GameMaker:Studio preferences where you can adjust how the program looks as well as different behaviours when dealing with resources etc... For further information on this please see GameMaker:Studio Preferences Exit: We know that making games is fun and addictive, but you need to eat and sleep sometimes! So press this to exit GameMaker:Studio. If you changed the current game project then you will be asked whether you want to save it before the program closes. Next: The Edit Menu

Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

The Help Menu


Here you can find out all about the various options available to you from the drop down help menu.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 92 de 134

Here you find some commands to help you:


Contents: Use this command to bring up the help file. Extension Packages: Use this to show the help file for specific extension packages that you have installed. Please note that this option will not be present in the Free Version of GameMaker:Studio Open Tutorial Panel: If you have been working through a tutorial and close the panel showing the text that accompanies it, you can re-open it using this command. News: Here you can see the most recent news about the GameMaker range of products and the company YoYo Games. Website: Connects you to the YoYo Games official website. Forum: This will connect you to the GameMaker Community (GMC) forum, where you can find help with any problem as well as tutorials, resources and much more all related to GameMaker:Studio. Wiki: This will take you to the GameMaker wiki where you can find plenty of official information about the use of GameMaker products. Release Notes: Opens a tab in your browser to show the current build and accompanying release notes for your version of

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 93 de 134

GameMaker:Studio. Helpdesk: This link will take you to the YoYo Games Helpdesk and Knowledge Base where you can find additional tutorials and FAQs, as well as ask questions about the product. Report A bug: While we make every effort to make sure GameMaker:Studio is bug free, in a program as large and complicated as this it is a nearly impossible task. So, if you find something you think is a bug, then please use this link and report it to us and we'll do our very best to fix it. Open GameMaker in Explorer: Use this command to open the folder location of GameMaker:Studio in Windows Explorer. Open Project in Explorer: Use this command to open the folder location of your current project in Windows Explorer. Update Licence: if you have bought a new licence to upgrade GameMaker:Studio to a new version or to add a new target module, then you should select this option to activate it. Note that if you bought GameMaker:Studio through Steam this option will not be present. About GameMaker:Studio: Gives information about this version of GameMaker:Studio, including the product key and the user it's registered to.

Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

Back: The File Menu

The Resources Menu


Here you can find out all about the various options available to you from the drop down resource menu.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 94 de 134

In this menu, you can create a new resource for each of the different types as well as change the global game settings, add Constants, define Triggers and select files to include in the final game (more information on each of these items can be found further on in the manual). For each of these commands there is also a button on the tool-bar and a keyboard shortcut.

Create...: Creates a new resource of the type selected. A form will then open in which you can change the properties of that resource (more on each of the resources in the following sections of the manual) Change Global Game Settings: This opens the Global Game Settings window where you can change many things relating to how your game behaves. More information can be found here. Select Extension Packages: Here you can select the extension packages that you wish to have GameMaker:Studio use in your current project. More information can be found here. Please note that this option will not be present in the Free Version of GameMaker:Studio Define Constants: This will open a further window where you can define your own constants for use within your projects. More information can be found here. Included Files: Here you can select the external files that you wish GameMaker:Studio to include in your current project. More information can be found here.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 95 de 134

Note that many of these commands can also be given by right-clicking on a resource (or a resource group), and then using the appropriate action from the pop-up menu. Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Scripts Menu

The Run Menu


Here you can find out all about the various options available to you from the drop down run menu.

This menu has options that relate to testing your games and to setting up configurations (note that each of these items has a corresponding button on the GUI Toolbar):

Run Normally: This will cause the game to run as if it was finished and installed on the target platform for play testing. Run in Debug Mode: This option runs the game in debug mode. For a windows game, this opens another window (apart from the game window) with various debug options which you can see below:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 96 de 134

For more information on debugging in GameMaker:Studio, please see the section Advanced Use - Debugging.

Clean Build: This is the same as clicking the green "broom" icon in the main IDE toolbar, and will clear the asset compiler cache. This is important as it prevents any "stale" assets from corrupting your game. It is not necessary to clear the cache every build, but should you be getting any odd errors or corrupted sprites, it should be done, and it should always be done before building any final packages for deployment..

The following two options are limited to the Professional Version of GameMaker:Studio and will not be present on other versions:

Configuration Manager: Selecting this will open the Configurations Manager. Configurations: Placing the mouse over this option will open up a sub-menu with a list of all the currently available configurations from which you can select one to use (this shows the same options as the configurations tab in the main GUI.

NOTE: Although the Windows 8 target is similar to the HTML5 one, it won't allow multiple instances of the same app to run at a time, and if the file is running it can't overwrite it. This means that you will have to close the app before saving/testing a new version.

Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Window Menu

The Scripts Menu


file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm 30/12/2013

Using GameMaker:Studio

Pgina 97 de 134

Here you can find out all about the various options available to you from the drop down script menu.

This menu has a number of options that relate to the internal scripting functions as well as the script resources that you can create:

Show Built-in Variables: This will bring up a list of all the global variables as well as a list of all the instance variables common to all objects. Show Built-in Functions: This will show a complete list of all the functions available in the GameMaker Language (GML). Show Extension Functions: If you have installed any extensions then clicking this will bring up a combined list of all the functions and constants used by them. Show Constants: This will bring up a list that shows all the constants that exist to be used in GameMaker:Studio. Search In Scripts: This brings up a search form that can be used to search through various resources to find a specific string or function and it includes a number of options to make the search as narrow or as broad as necessary. This is an extremely powerful tool for changing things within a game or for debugging when there is a problem with a variable name or a function. The following window will pop up and allow you to narrow or widen the search as needed:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 98 de 134

Check Resource Names: To check and make sure that no name conflicts exist you can choose this command. GameMaker:Studio will not allow you to name two resources with the same name, but if you merge files or import an older format project, then this may happen. If it does, you may get odd behaviours and even errors, which can be resolved by using this. Check All Scripts: This will run a check through all objects, instances and rooms that have GML in them for errors and display them in a list. You can then click on any errors that are displayed to be taken to the properties window of the relevant resource to fix it.

Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Run Menu

The Window Menu


Here you can find out all about the various options available to you from the drop down

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 99 de 134

window menu.

In this menu you find some typical commands to manage the different properties of the actual windows in the main GameMaker:Studio form:

Cascade - Cascade all the windows such that each of them is partially visible. Show Compile Form - This will show the compile form in the IDE if you have previously closed it. Arrange Icons - Arrange all the iconified property windows (Useful in particular when resizing the main form). Close All - Close all the property windows, asking the user whether or not to save any changes made.

Back: The Drop Down Menus Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Help Menu

Events
GameMaker:Studio uses what is called an event driven approach, and this section of the manual outlines how that works.
So, what are events? Basically, these are discreet moments in the game loop where things are made to happen based on what you have programmed for them. You see GameMaker:Studio works with cycles of these events - from the moment a room is started to the moment it is finished there is a game loop running where every step (a step is a moment in game time, governed by the room speed setting) a series of events are run, and you can choose to place code or DnD actions in your instances that respond to these events. Let's look at a typical object setup with events and actions:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 100 de 134

As you can see in our example object there are a number of events listed that it should respond to, but initially when you create an object this list is empty and you must decide which events you need and what instances of that object should do when those events are triggered. To add events into the object, you press the Add Event button found at the bottom of the events list which will bring up the following window:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 101 de 134

That is the list of all the basic events which an object can respond to, although some of those events also have sub events to further define behaviours. For example, if you add a Key Press event you will then get a further window popping up with the sub events that allow you to select which key the object should respond to. Once you have selected your event, you can then add your DnD actions or code into the Actions section on the right of the event list, which means that you are telling GameMaker:Studio that when this event is triggered, these actions should be performed. here is an example image to illustrate this:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 102 de 134

You can change the order of the actions in the list by pressing and holding the left mouse button and then dragging to move the selected DnD action icon. Note that if you hold the <Alt> key while dragging, you can make a copy of the action. You can even use drag-and-drop between action lists for different objects, either by having them both open and literally dragging the DnD action icons between them, or you can click with the right mouse button on an action which will open a menu where you can edit, cut, copy, paste and even delete actions (deleting can also be done by using the <Del>

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 103 de 134

key). You can select multiple actions for cutting, copying, or deleting by holding the <Shift> key or <Ctrl> key and clicking on a series of action icons, and pressing <Ctrl><A> will select all actions. Finally, when you hold your mouse at rest above an action, a longer description is given of the action in a pop up window so that you can see what it does without actually having to open it. There are two further buttons available at the bottom of the events list, Delete and Change. As you may well imagine, the Delete button will permanently remove the currently selected event and all its associated actions from the object (Events without any actions assigned to them will automatically be deleted when you close the form so there is no need to delete them manually). The Change button can be used to change the current event into another one, and in this way transfer all the associated actions to the new event (if the event you try to change to has already been defined then nothing will happen). These actions can also be accomplished by simply right clicking on the event and selecting the appropriate choice from the pop up menu that will open. In this way you can "build" behaviours that are triggered by specific events in your game by just adding in more actions or more code (you are not limited to the amount you can add for each event). If you wish to know more about all the available actions then you can go to the Actions section of the manual, and the Reference section has all the information you need on the available code functions.

Event Order
It should also be noted that the exact order that the events are going to occur in each step cannot be clearly stated, simply because it depends on the internal workings of GameMaker:Studio, which is subject to change as the software develops. However there are certain events that always run in the same order. The first set of events that will always happen the same way are those that occur when a room is first entered and the order of events for that is:

Create Event of each instance, followed by the Instance Creation Code of each instance Game Start Event (this will only be run in the very first room of the game) Room Creation Code Room Start Event of all instances

It is also worth noting that you can also set the order in which specific instances are created within the room editor itself. See the section on Instance Order in the Rooms - The Settings Tab for further details. Other than those specific events, the only known order that will always occur in the same way no matter what belongs to the three step events and the two draw events. These will always remain consistent, so if you have code that relies on specific timing during each step of your game, you should use:

Begin Step Event Step Event - The step event is executed just before instances are put in their new positions.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 104 de 134

End Step Event

Two of the three sub events for drawing are also always dealt with in the same order as follows (the Resize event is triggered differently):

Draw Event Draw GUI Event

The sections below deal with each available event: Create Event Destroy Event Alarm Events Step Events Collision Event Keyboard Events Mouse Event Other Events Draw Events Asynchronous Events

Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Actions

The Alarm Events


file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm 30/12/2013

Using GameMaker:Studio

Pgina 105 de 134

The alarm events are one of the many events that can be triggered in an instance and may contain code or actions.
The Alarm Events The alarm event is split into 12 sub events, one for each of the possible alarms that can be set in an instance. So, when you click on the add alarm button

you are presented with this window: Here you select the alarm that you wish to create and, once that is done, you will see that it has been added to the event window allowing you to add actions to it as normal. But what is an alarm? Well, it is a special event that does nothing unless the alarm has been previously set, and then it will wait until that alarm has counted down to 0 before running the actions or code that you have added into it. So, say you set alarm[0] in the create event of the object to 30, this means that GameMaker:Studio will count down 30 game cycles (steps) before it runs the actions or code that are placed in the alarm [0] event. This can be very useful as it allows you to set things in motion at precise moments, and you can even have them repeat as there is nothing to stop you setting an alarm in its own event! Imagine you have a monster and you want it to turn right every three seconds... well, you would set an alarm in its create event to the room speed*3 (if the room speed is 30, that's 30 steps per second, so multiply that by 3 and you get 3 seconds!) and then in the alarm event you would have the code or action to set its direction, as well as the action (or code) to set its alarm to room speed*30 again. In this way, you can

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 106 de 134

set up simple game loops where things only happen at specific intervals. NOTE: An alarm with no actions in it will not run. However, even with just a comment and no code, the alarm will count down. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: The Step Event

The Asynchronous Event


The asynchronous event is one of the many events that can be triggered in an instance and may contain code or actions.
Asynchronous Event This event is special in that it is not triggered by GameMaker:Studio itself, but rather by the end of some other action, like the loading of a file, or the

reply from a web server. The actual event is split into various sub events: So, say you want to add an image file to GameMaker:Studio. Well, you would code this in another event (maybe the create event) of an instance and then have that instance draw a loading bar while waiting from the callback that tells GameMaker:Studio that the file has loaded. This callback triggers the Asynchronous Event where you would then do something else, like go to another room.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 107 de 134

For more details on this event and how it functions please see More About Async Events. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Create Event

The Collision Event


The collision event is one of the many events that can be triggered in an instance and may contain code or actions.
The Collision Event Obviously when making a game, it is very important that you know when two (or more) instances of an object have collided, and for that we have the collision event. This is an event that you place in an object and then specify against which other object you should be checking for collisions. Now, when you don't have physics turned on, these collisions will be calculated based on the mask of the two objects (the mask is defined within the sprite properties, or can be assigned independently in the object properties) and whether they over-lap or not. Note, that if one or the other instances in the collision does not have a mask assigned (or the sprite mask is set to nothing), even if it is drawing something no collisions will be detected. Also, if the object being collided with is solid, before the collision event code is run the instance is placed back at its previous position before the collision was registered, but only if there is a collision event defined. If you have physics on, the collision will be based on the type of collision shape that you have defined for the object in its physics properties, as will its reaction to the collision. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Keyboard Events

The Create Event


The create event is one of the many events that can be triggered in an instance and may contain code or actions.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 108 de 134

The Create event This event happens when an instance of the object is first created, and is the very first thing that happens within an instance placed in the room through the room editor when a room is entered. This means that this event is the ideal place to initialize variables, start Timelines, set paths etc... and do anything else that generally only needs to be done once or only when an instance first appears in the room. NOTE: This event will always be called the moment an object is created. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Destroy Event

The Destroy Event


The destroy event is one of the many events that can be triggered in an instance and may contain code or actions.
The Destroy event This event is the very last event to be executed when an instance is destroyed. It is often overlooked when adding behaviours to objects, but it can be very useful, for example by creating explosion or particle effects when an enemy is killed, or for re-spawning a new instance of the object in another part of the room, or even for adding points onto a score. NOTE: This event is called the moment the action or code to destroy the instance is run. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Alarm Events

The Draw Event


The draw event is one of the many events that can be triggered in an instance and may contain code or actions.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 109 de 134

Draw Event This event is the one that governs what you see on the screen when you run your game, and is split into three separate "sub-events" - the Draw Event,

the Draw GUI Event and the Resize Event: The main draw event is the one covered here and runs before the Draw GUI event, meaning that everything that is drawn in this event is drawn beneath that of the Draw Gui event, regardless of depth (anything drawn in the Draw GUI event will always be drawn over anything drawn in the normal draw event, regardless of depth). All instances have a draw event which will run as long as the instance has the visible flag set to true (invisible objects do not trigger a draw event), and note that even if you have defined nothing for this event in the object properties (ie: no code nor actions), if the object has a sprite assigned it has a draw event! You see, GameMaker:Studio has two ways to draw things:

the default draw, which is when you define the sprite in the object properties and place no actions or code in the draw event, in which case GameMaker:Studio will draw that sprite, but note that any transforms you perform in other events to change the image scale, index, blending etc... will be reflected too as long as the draw event is empty. the custom draw, which is when you place code or actions in the draw event. This is telling GameMaker:Studio "I want to control what you draw for this object" and it completely over-rides the default draw. This means that you can have an object with a sprite assigned, then set the draw event to draw text and the sprite will not be drawn as you have not told GameMaker:Studio to draw it.

The draw event is a very intensive event too, in that it's one of the events that takes up most time and resources... to that end it is never a good idea to do anything in the draw event other than drawing, so save your large code or complex actions for the step event or alarms or whatever, but leave the draw event clear for the drawing as that's what it does best. Note: What you draw has nothing to do with the collision engine you choose (traditional or physics) as that is defined by the object properties and the sprite or mask that the object has been given.
Copyright YoYo Games Ltd. 2013 All Rights Reserved Back: Events

Next: The Draw GUI Event

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 110 de 134

The Draw GUI Event


The Draw GUI Event is one of the many events that can be triggered in an instance and may contain code or actions.
Draw GUI Event This is a sub-event of the Draw Event and is specifically designed for drawing GUI (Graphical User Interface) elements that are not affected by the view scale or rotation. This means that you can have an instance draw all the elements for your HUD without having to base all the positioning on the position within the room of the instance and the position of the current view either. When drawing in this event it is important that you understand that the draw coordinates do not change even when views are active and 0,0 is always the top left hand corner with the width and height of the display being your maximum drawing width and height. Depth ordering is still maintained between different instances (so an instance at a low depth will draw over one at a higher depth) and also within the event itself (the first things drawn will appear underneath the later things being drawn) and it can also be used in conjunction with the normal Draw Event (which will be affected by the view position, scale and rotation as normal). If you have no Draw Event but you do have Draw GUI Event, then GameMaker:Studio will still default draw the sprite for the instance (if it has one) as normal. You may notice depth issues when using this event due to the fact that it is not dealt with the same was as the traditional draw event. What happens is that the normal draw event for all instances is resolved first and then the draw GUI event for all instances is resolved. So the depth order between instances with draw GUI events is always respected, as is the depth order between instances with normal draw events, but the draw GUI event will always draw over anything drawn in the normal draw event, even if the instance doing the drawing it is at a higher depth than other instances. NOTE: This event will, by default, draw 1:1 with the background canvas size, which can make things a little complicated, and perhaps unexpected in places, on those target platforms that permit a fullscreen mode (HTML5, Windows, Ubuntu (Linux) and MacOS). For example on HTML5, going fullscreen the GUI draws pretty small when everything else gets bigger because the background surface is now the size of the screen. However, on Windows, Ubuntu (Linux) and MacOS when you go fullscreen it doesn't always change the size of the background canvas, meaning that whatever is drawn in this event can be scaled up like everything else, but you can get around this if you use the window_set_size to force it to be the same as the client area, then it will be small, just like the HTML5 one. You may also lock the GUI event to a specific size and this will then be scaled to fit the display dimensions automatically by using the function display_set_gui_size. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Resize Event

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 111 de 134

The Keyboard Events


The keyboard events are three of the many events that can be triggered in an instance and may contain code or actions.
The Keyboard Events Obviously when creating a game, letting the player control the different aspects is very important. To that end GameMaker:Studio provides you with a very comprehensive list of keyboard sub events that can be used in any of the three main keyboard events. As these are all the same for each of the three events they will all be covered together in this section of the manual. Before looking at the sub events, let's look at the three keyboard events themselves:

Keyboard Pressed Event: This event is only triggered once whenever the selected key is pressed down Keyboard Event: This event is triggered continuously, every step, for as long as the selected key is pressed down Keyboard Released Event: This event is only triggered once whenever the selected key is released

As you can see, each of these events does a very different thing and knowing the distinction between them can help you solve many a problem or do things in your game in a much more efficient way. It should be noted that keyboard events are actually triggered in all active instances in a room whenever a key is pressed, but only those that have an event defined for that particular key will respond and you can create multiple keyboard events in any object and the instances of that object will respond to all of them while the game is running. When you add any keyboard event to an object, you will be presented with the keyboard sub event menu where you can specify the key you are to be

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 112 de 134

checking for:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 113 de 134

Now, most of them are fairly obvious, but let's just go through the sections briefly - at the top we have the arrow keys, followed by the most used modifier keys, then the rest of the keyboard (split into sub sections as you can see) and finally two very special sub events, No Key and Any Key. As their names imply, these are sub events that check for when no key is pressed or for when any key is pressed. Please note that the keys on the numeric keypad only produce the corresponding events when <NumLock> is pressed.

Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Mouse Event

The Mouse Event


The mouse event is one of the many events that can be triggered in an instance and may contain code or actions.
Mouse Events The mouse event is separated into a series of sub events that can be selected to give you a more precise control over what is happening in your game.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 114 de 134

Here you can see exactly what these sub events are: The left, right and middle button events (whether normal, pressed or released) all work on the mask of the instance that has the event. What this means is that GameMaker:Studio will check the position of the mouse in the room when those buttons are used against the collision masks of the instances that have a mouse event. If there is a "collision" then the event will be triggered, so make sure than any object with these events has a sprite with a valid mask or that the object has a mask selected in the object properties. As their names imply, these events will be triggered either once when the chosen mouse button is first pressed or released, or continuously each step while the button is maintained. The mouse enter and release events are also similar to the button events in that they too rely on the mask of the instance to work, but this time they are triggered when the mouse first "enters" (touches) the object or when the mouse "leaves" (stops touching) the object. These events are not continuous however, and are triggered only once for each time the mouse enters or leaves the object - so they are an ideal method for creating, for example, buttons that need to change as the mouse hovers over them before going back to normal when the mouse is removed.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 115 de 134

Finally we have another section to the mouse events which is called the Global Mouse. in this sub-menu you will find a selection of events that are for generating mouse events in instances even when the mouse is not over them or even near them. These are events that are generated for all instances and if there are actions or code defined for the specified event then it will be run, regardless of the position of the mouse within the game room. Please note that on devices (iOS and Android targets) the left mouse button can also be used to check for a finger tab on a touch screen, and the right mouse button is triggered by a double tap on the screen. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: The Other Event

The Other Event


The other events are some of the many events that can be triggered in an instance and may contain code or actions.
Other Events There are a number of special events for use when making games with GameMaker:Studio and they are mostly grouped together under the Other event and can be selected from the pop up menu of sub events that comes up when you select this. Here is an image of all these other events:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 116 de 134

Outside Room
This event is triggered when an instance goes outside the room, and is based on a check done against the assigned sprite (and its properties) of the instance, so that even if you have set the image x or y scale to a value other than one, this event will only be triggered when the whole sprite would be out the screen. If the instance has no sprite, then the position of the instance is used and the moment its x or y position is outside of the room then it will trigger the event too. This event is typically used for things like bullets, where they are destroyed once they leave the room so you don't end up with

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 117 de 134

millions of bullets flying away infinitely and causing your game to slow down.

Intersect Boundary
This event is triggered when an instance "touches" the inside edge of the room, and, like the outside room event, is based on a check done against the assigned sprite (and its properties) of the instance, so that even if you have set the image x or y scale to a value other than one, this event still be triggered the moment a part of the sprite intersects the room boundary. If the instance has no sprite, then the position of the instance is used and the moment its x or y position intersects the room boundary then it will trigger the event too. You can use this event to do things like tell an instance to "bounce" back in towards the room again rather than go outside.

Views
Views are normally defined in the room editor and used to show only a small area of a large room at any one time. This event has its own sub event list that is split into two categories (outside view and intersect boundary), with eight different events in each corresponding to the eight available views. These two categories function exactly the same as the respective room events, only taking the boundary of the view as the thing for the instance to check against rather than the room.

Game Start
This special event is triggered only once in the whole game and only for those instances with actions or code placed in the event. These instances must be present in the first room of the game and have been placed there in the room editor, rather than have been created dynamically. It should be noted that this event happens after the create event of all instances and so can contain code or actions with variables that have been previously defined in that event. This event is typically defined in only one "controller" object and is typically used to initialize global variables, start music, read from files and any other thing that is usually only done once at the start of a game.

Game End
Similar to the above mentioned Game Start event, this event is only triggered once in the whole game and that is just before the game window actually closes. Again, for an instance with this event to actually do anything it has to be in the room as the game is closed. Please note that this event in really only viable for Windows, Ubuntu (Linux) and MacOS games as mobile devices may just close the game without giving GameMaker:Studio the chance to call this event. For browser games made with the HTML5 module, this event should work when the game tab or browser is closed, but not all browsers support this feature (Firefox, Chrome and Safari do at the time of writing) so care must be taken when using it. Typically you would use this event to save data.

Room Start

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 118 de 134

This event happens for all instances initially in a room when the room starts. Please note that it happens after the creation event and so can depend on variables and things defined previously in that event.

Room End
This event happens to all instances that are in the room when the room ends. This event is very useful for "cleaning up" after a level has ended, for example you can delete loaded resources here, or remove a particle system to prevent memory leaks etc...

No More Lives
GameMaker:Studio has a built-in lives system, which is basically a global scope variable that is created for you at the start of a game. There is an action to set and change the number of lives, and you also have the option to manipulate this variable through code. This event will be triggered whenever the number of lives becomes less than or equal to 0 and it is typically used to end or restart the room.

No More Health
GameMaker:Studio has a built-in health system, which, like Lives above, is basically a global scope variable that is created for you at the start of a game. There are actions to set and change the health variable as well as to draw a health-bar, with code available to change them too should you prefer to use GML. This event is triggered whenever the health becomes less than or equal to 0. It is typically used to reduce the number of lives or to restart the game or room. Animation End In GameMaker:Studio sprites are not static things as they can have sub-images and be animated at different speeds. Each frame of an animation (called a sub-image) has its own number, starting at 0, which can be checked in code or even through actions, but sometimes all you really need to know is when the animation has ended. That's when this event is triggered, right at the end of the animation when the sub image index shows that the last frame has been reached. This event is really useful for many things, for example an explosion object where you can set the instance to destroy itself when the last frame of the animation is reached.

End Of Path
Paths can be an important part of making any game, whether it is for a tower defense type game, or a shoot-em-up or whatever, and it's often really important that an instance does some particular action when it reaches the end of its path. This event detects this and is triggered when it happens allowing you to add in code or actions to deal with the circumstances, for example in a tower defense game you would use this to destroy the instance and remove a health point from the goal object.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 119 de 134

User Defined Event


These are special events that are not triggered by GameMaker:Studio itself, but have to be implicitly called by you from a code box while the game is running. These events can contain code or actions and do the same things as any other event, making them very useful for creating your own events that happen when you decide and not GameMaker:Studio decides! Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Draw Event

The Resize Event


The Resize event is one of the many events that can be triggered in an instance and may contain code or actions.
Resize Event This is a sub-event of the Draw Event and is specifically designed for reacting to the change in the Windows 8 canvas size when the game window is "snapped". On the Windows 8 target platform it is important that you catch any resizing of the game canvas from the "snapping" of the game window (when the user drags the window to the side of the display, for example). This event will do just that and is triggered every time the canvas is changed, permitting you to add custom code here that will resize the view or reposition HUD elements as necessary. This function is provided as a convenient way to avoid having step event code that checks for these things all the time. NOTE: You cannot draw in this event! It is triggered by resizing the canvas and is only for catching this change... any drawing that should be done still must be in one of the other two draw events. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Asynchronous Event

The Step Events

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 120 de 134

The step events are one of the many events that can be triggered in an instance and may contain code or actions.
The Step Events GameMaker:Studio splits time into steps with the room speed defining how many of these steps there are supposed to be per second. A step, is basically the loop that runs constantly with all the events being checked and triggered as necessary while the game runs, so as you can imagine, the Step Event is an event that is checked every single step of the game while the instance exists.

The step event is actually comprised of three sub events that are outlined below: For most things the standard step event will be fine to use, but sometimes you want a bit more control over what code runs and at what time, so for that you are provided with the begin and end step events. All three are checked every step, but their order will never vary even through future updates to the GameMaker:Studio engine, which means that this is the only reliable method of making sure that something always happens before something else. So what can the step event be used for? Well, it can be used for actions or code that needs to be executed continuously. For example, if one object should follow another, here you can adapt the direction of motion towards the object we are following to keep it moving smoothly behind. Be careful with this event though! Don't put many complicated actions in the step event of objects, especially if you are planning on having lots of instances of the object in your game room, as this might slow the game down. Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: The Collision Event

The Trigger Event (Obsolete)


The trigger event is one of the many events that can be triggered in an instance and may contain code or actions.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 121 de 134

Trigger Event A trigger event is an event that permits the user to define special conditions which will "trigger" a set of code or actions to run. When you add a trigger event you will be presented with a menu of sub events like this:

The first two things you see on that menu are just examples of triggers that have been defined previously (these were created to give an example and are not standard GameMaker:Studio triggers), and the last section, "Add/Modify Triggers", is where you would define them so that they show up on this menu. Important The trigger event has been made obsolete in GameMaker:Studio and the references to it in this manual are only due to the fact that previous versions of GameMaker may have them. In this case it is important to know how they worked so as to make importing these older projects easier. For more in depth information on triggers, please see the following section of the manual - Obsolete Functions: Triggers Back: Events Copyright YoYo Games Ltd. 2013 All Rights Reserved

Creating Rooms
Rooms are where everything in your game happens, and this section outlines how you create them and add instances to them.
All games that you make in GameMaker:Studio need at least one room to run (but can have many, many more) , and a room is just a space where you place instances of the objects that make up your game. When you first create a room in your resource tree you will be presented with a new window

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 122 de 134

with which to edit its properties, something like this:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 123 de 134

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 124 de 134

As you can see, most of the room editor is taken up with the a visual representation of the room itself, where you place the objects, tiles and backgrounds for your game, but around the edges there are a number of buttons, tabs and information bars that help you to create your game. NOTE: If you are using the Free version of GameMaker:Studio you are limited to a maximum of 5 rooms per game. For more details see here.

The Toolbar
At the top of the form there is the tool bar, which has a number of buttons that refer to different actions in the room editor.

Confirm: Clicking this button will close the room editor and save any changes you have made. Beware, as this will not warn you that the room has changed, as clicking the close button would do, but will just save directly any changes you have made. However, depending on the GameMaker:Studio preferences, you may be asked if you want to remove any instances that have been placed outside the room or not. Undo: This is a simple, one level, undo button. By one level, we mean that only the last action performed will be undone. Instance Actions: These buttons allow you to change certain properties of the instances (and tiles if you are in the "Tile" tab) in the room, specifically: clearing all instances from the room, shifting all instances a set amount along the x and/or y axis of the room, locking instances (so they cannot be moved or edited) and unlocking instances. Grid Snap: These values can be changed to make instances snap to a different grid resolution. A value of 0 will switch snapping off. Grid Type: Switch the grid between standard 2D and isometric 2D formats. Visualisation Options: By clicking this you will open a drop-down menu where you can switch on or off the visualisation of many room elements, like instances, tiles, views etc...

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 125 de 134

Zoom Controls: The main view of the room editor can be zoomed in and out to show more or less detail either using these controls or by scrolling the mouse wheel (if you have one). Instance Order and Shortcuts: Both these buttons will bring up separate windows, with the first giving you the option to change the order in which instances are created at room start (see the Room Settings page for more information), and the second shows the available keyboard shortcuts that you can use when editing rooms.

The MiniMap
As you can imagine, this is a miniature representation of the whole room. you can click and drag the current area around on the minimap and the main view will scroll and pan to match, or you can just click on the minimap to have the main view jump to that position.

The Info Bar


While placing tiles and instances within a room, you often need extra information about them at a glance. For that you have the Info Bar which shows the current mouse position within the room, the id and object_index of the instance that the mouse is currently over, and further context sensitive information like whether the instance has code or not in its room create event.

The Tabs
At the left you will see six tabs that open separate sub-pages in the area on the left, but in this section we will only deal with the three most important ones: The settings tab, the backgrounds tab and the objects tabs. Further information on these tabs can be found in the sections below: 1. Settings 2. Backgrounds 3. Objects For information on the other tabs as well as the advanced functions available to you in the room editor please see the section - Advanced Use: More About Rooms. Back: Using GameMaker:Studio Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Game Information

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 126 de 134

Backgrounds
Within the tab backgrounds you can set the background images for the room.

This tab is where you can define the backgrounds of your room. A background can be made up of a single color, an image, or a combination of color and transparent images. The following options are available:

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 127 de 134

Draw Background Color


When you tick this option, you are telling GameMaker:Studio to draw a background color below everything else in your room. This color can be selected by clicking on the color box which will open the following standard color picker: The background color is only useful if you don't use a background image that covers the whole room, or if that image is partially transparent, otherwise it is best to un-check the box labeled Draw background color as this will save some processing time. It is worth mentioning that for the HTML5 module, switching this option off and unticking "Clear Background with Window color" in the Views Tab permits you to use the special function draw_clear_alpha to clear the canvas alpha, making your game "transparent" and so showing any background images that you may have on the host web-page HTML. Warning! Having a room with no background color and no background image will result in "artifacts" being left behind by all moving instances within the room on most of the target platforms (which can give some interesting results!)

Background Number
Underneath the color picker, you can see a list of eight backgrounds numbered from 0 to 7. These can all be defined for one room, and you can have all eight active at any one time if you wish. When you select one, all the options beneath will then refer to that background only, and in this way you can define the properties for all eight independently. The rest of the options on this page are applied to each individual background that you select.

Visible When Room Starts


This toggles the background when the room starts between being visible or not. You may have a game where only one of the backgrounds is visible at the start of the game, but later you wish to set another up as visible. So, you set up the two backgrounds in the room editor and then in a later event within an instance, you can toggle between them. Another thing you may want is several backgrounds visible at the same time, especially if you wish to have semi transparent parts, different sizes or even parallax scrolling, so you can toggle this to have various visible at once.

Foreground Image
Toggling this converts the background into a foreground, which basically means that instead of being drawn below everything it is drawn on top of everything.

Background Select

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 128 de 134

If you click on this box, you will be presented with a list of all the background resources available and you may select one of them to be used as the background image for the currently selected background.

Tile Horizontally And Vertically


By checking these options you are telling GameMaker:Studio to tile the background in the chosen direction infinitely. You can choose the position within the room for the coordinates of the top left hand corner of the background and the room will be tiled from this point, or, if tiling is not activated, the background will be drawn at that point.

Stretch
This option will stretch the background to cover the whole room. Bear in mind that this option will make backgrounds that are smaller than the room larger to fit and make backgrounds that are larger than the room smaller to fit too. Note that the ratio of the image will not be maintained, so some distortion may occur when using this option.

Horizontal And Vertical Speed


These options allow you to set the background image to scroll through the room at a given speed. You can have positive or negative values, where a positive value for the horizontal scroll would be to the right (negative to the left) and a positive value for the vertical scroll would be to the bottom (negative to the top). The speed is calculated in pixels per step, so a horizontal speed of 5 will move the selected background through the room 5 pixels to the right every step. This can be particularly useful for top down shooter games, where you can have a scrolling tiled background to give the illusion of movement and make the room seem infinite even when it is really small. Be careful using these options with stretched backgrounds as the result can sometimes be rather ugly. Back: Creating Rooms Copyright YoYo Games Ltd. 2013 All Rights Reserved Next: Objects

Objects
This section discusses the objects tab in the room editor.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 129 de 134

The objects tab is where you can select an object and then place an instance of that object into the selected room. First you must decide which object from your resource tree you wish to add, and this can be done by clicking on the Object to add with left mouse menu button, or by clicking the large area above where the object sprite is normally shown. If the object has no sprite, this box will be blank, but if it does, the sprite will be shown on a chequered background along with its x/y origin which indicates how the instance will be aligned with the grid once placed in the room editor.

Instance properties

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 130 de 134

Once you have selected the correct object, you can now place instances of it within the room by clicking anywhere, with the instance being snapped to the grid (if you have the snap values other than 0). There are a number of additional options which will be made available to the right of the object image that you can then change for the instance that you have just placed within the room. These are:

ScaleX - With this you can set the scale along the x-axis of the instance. 1 is the default value, and you can use negative values too to "mirror" the instance. ScaleY - With this you can set the scale along the y-axis of the instance. 1 is the default value, and you can use negative values too to "flip" the instance. Rotation - Rotates the instance around its x/y origin by the given number of degrees. You can use any real number for this value. Alpha - With this you can set the alpha value for the instance from 0 to 255, where the default value of 255 is completely opaque, and 0 is completely transparent. Color - This option sets the color to be blended with the current instance sprite. White is the default color (which means that the instance will be drawn "as is" with no blending). Flip X - Flagging this will mirror the instance sprite along the horizontal (the same can be achieved by setting the ScaleX value to 1). Flip Y - Flagging this will mirror the instance sprite along the vertical (the same can be achieved by setting the ScaleY value to -1).

You should note that a selected instance can also be scaled by clicking on one of the corner "nodes" that mark the bounding box of the instance when you select it in the room editor. By clicking the node and dragging the mouse, you can change the image scale, and these changes will be reflected in the values of the above mentioned areas.

Delete Underlying
The normal behaviour for placing instances within the room is that if you place an instance on top of another one, the original instance is overlapped by the new one. Generally this is what you want to happen, but not always, and so there is a check-box at the bottom of the objects tab which you can flag to make any new instances delete those that were place before in the same position. The "hitbox" used to calculate whether an instance is over another one or not is the bounding box taken from the collision mask defined for the sprite that the instance uses. if the instance has no sprite, then only those that have been previously placed at the same position will de removed.

Shortcuts
There are also a number of keyboard shortcuts that can be used to make your life easier when placing instances (you can open the following window

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 131 de 134

that shows them all from the toolbar at the top of the room editor):

Clicking with the left mouse button in the room will place an instance of the currently selected object, and clicking an instance will permit you to move it around the room. Holding the <Alt> key while placing the instance will make ignore the grid snapping and be placed exactly where you release the mouse button. Holding the <Shift> key while clicking the left mouse button on an instance will add it to the selected group. In this way you can select multiple instances which can then be moved together by clicking and dragging the bounding box, or they can be copied and pasted, even into other rooms. Holding the <Control> key while clicking the left mouse button will add a new instance on top of previously placed ones. Holding the <Shift> key and the <Control> while clicking the left mouse button will add multiple instances like a "brush" when you drag the mouse around. Holding the <Space>key while clicking and dragging with the left mouse button (or simply clicking and holding the middle mouse button) permits you to scroll around the room. Right click on an individual instance will bring up a special menu with further options (more information on this can be found here Advanced Use: More About Rooms). To remove an instance from the room, hold the <Control> key and then right click the instance. To remove all instances at the mouse position, hold <Shift> key and then right click the position. Holding the <Control> key and pressing the "C" keyboard key will copy the selected instance or instances.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 132 de 134

Holding the <Control> key and pressing the "V" keyboard key will paste the selected instance or instances, even in a different room from that in which they were copied. Using the mouse wheel permits you to zoom in and out of the room editor. Next: Settings

Back: Creating Rooms Copyright YoYo Games Ltd. 2013 All Rights Reserved

Settings
Each room has a number of settings that you can change by clicking on the settings tab.

This tab is where you set the basic details of your room and should be your first stop whenever you create a new room. The following settings are available:

Name

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 133 de 134

The "Name" of your room is the unique identifier that you can use to direct GameMaker:Studio to the correct resource. This name is really just a "pointer" as it holds the internal id of the room and "points" GameMaker:Studio to the correct resource when it is referenced. This means that it is very important that no other resource has the same name as this will cause conflicts and cause unexpected errors within your game. This name is what you will use in all code and actions that move the player from room to room or change room properties.

Width and Height


As you can imagine, a room has to have a size and this is defined by the values that you input for its width and height, in pixels. Be careful here, as it's very easy to say "I'm making a space game, let's have a room 100,000 x 100,000 pixels!" That is a recipe for disaster! GameMaker:Studio is powerful, but there are limits, and so when dealing with rooms it's much better to keep them as small as possible and then optimise your game around them, especially if you are making a game for mobile devices or the web.

Speed
The room speed is defined as being the number of steps per second that GameMaker:Studio should run at. This is not the same as the fps (frames per second) which can (and usually does!) give a different value. The room speed is the speed at which GameMaker:Studio ticks over and is a constant value, however the fps will fluctuate and is the actual speed at which the game is running. The typical room speeds for a game are 30 or 60, but some people like to set it slightly higher to 100 or 120. There are many arguments about which room speed is the ideal, but the actual answer depends on what type of game you are making, the size of the room, the number of instances and how intensive the code is. For example, if you have a large room (anything over 1024 px) and a room speed of 30, the game may appear "choppy" as the larger the area you are looking at, the easier it is for the eye to perceive low room speeds, but if the game is intensive then setting the room speed to 100 may cause the game to "lag" as the fps drops due to the amount of processing being done. So take care with this value and try to always adjust it to what your game needs.

Persistent
Normally, when you leave a room and return to the same room later, that room is reset to its initial settings. This is usually fine for most games but it is normally not what you want in, for example, an RPG or any non-linear game, where you want to come and go between rooms and have them be way you left it the last time. Checking the box labeled Persistent will do exactly that. The room status will be remembered and when you return to it later, it will be exactly the same as you left it, with it only being reset to the start state when the game is reset. Note that there is one exception to this - if you marked certain objects as being persistent, instances of this object will not stay in the room but move to the next room.

Creation Code
If you click on this button you will open a code editor. This editor allows you to input functions and code that will be run at the start of the room, after the create event of all instances but before their room start event.

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

Using GameMaker:Studio

Pgina 134 de 134

Instance Order

On very rare occasions you may require your game to create one object before any of the others, but not wish to use an alarm due to dependencies between instances. In that event, you can use this button to open up the Instance Order window. Here you can select individual instances and move them up (or down) the creation order list, meaning that those at the top are those which are created first, while those at the bottom will be created last. Note that if the create event of the instance actually creates further instances, those instances will be next in the order for running their code, before going to the next instance set in this list. Back: Creating Rooms Copyright YoYo Games Ltd. 2013 All Rights Reserved

Next: Backgrounds

file://C:\Documents and Settings\Usuario1\Configuracin local\Temp\~hh98E2.htm

30/12/2013

You might also like