GameMaker:Studio Beginner Guide

GameMaker:Studio Complete Beginner Guide

By: Sebastian Frederick


Sprites are what hold the images and animations for your game. You can right click the sprite folder in the upper left and click “Create Sprite” to create a new sprite. Then double click it to open up its properties.

  1. You will want to name your sprite starting with spr_ because when you reference it in the code it will be easier. You will be able to type spr_ and scroll through a list of all your games sprites.

  2. This is the origin of your sprite. It is the point of where exactly the sprite will be drawn. It has a center button so you can click that to automatically center the orgin.

  3. Modify mask allows you to edit the collision mask. Basically with every object you have a sprite, and a mask. The mask can be the same as the sprite or you can define a custom mask that it will use for collisions. This is important for example if the sprite you are drawing has complicated edges and you want to use a simple box for more precise collisions.

  4. Edit and load sprite, load sprite to load an image or edit sprite to open the sprite editor

GameMaker:Studio has a built in sprite editor only slightly better than ms paint (because it uses alpha). You can use it in a pinch, but I would recommend finding better tools if you care about your game art.

This is a browser based pixel drawing tool that is really nice. I use it for pixel art.

You can also use the sprite editor to do useful things like crop, stretch, do some simple animations and rotations. The tabs at the top will help you do that. When you are done just press the green check mark and it will save the sprite.


Pretty self-explanatory. You can use any standard audio file (mp3,.wav,.ogg,.midi)


Handled similarly to sprites, these are for setting backgrounds to your rooms, and also for tilesets.


These allow you to create simple paths for objects to follow. Can be pretty useful if you don’t know how to program enemy AI and just want them to simply go back and forth or in a circle. I personally don’t ever use them anymore.


Scripts are ways to conserve time and make code more efficient and clean. I would explain more, but scripts are useless to you right now if you don’t know how to code.


I personally rarely use these as they are not HTML5 supported. (No browser) they basically let you play with the graphics by doing (usually fairly complicated) geometrically math to the screen. 


When drawing text in your game, you need to preload the fonts you want to use here. I recommend naming them starting with fnt_


Generally frowned upon by veteran programmers. They allow you to time actions easier and at certain times. It is generally a better practice to use alarms in your code rather than timelines which will be explained under events.


These are what contain the objects for your game. If you want, you can imagine rooms like levels for now. You can use the room editor to place objects in a room and create basic maps for your game. The room editor does not support z axis for 3D games but that’s only a worry if your game is 3D. Although I have made a few map editors in GameMaker and sometimes if your games are super complicated you might have to. 

The background tab lets you set a background image or color, you can also make it scroll. 

The view tab lets you set up a certain game screen size, limit what you can see of a room, or make it so the view follows the player. If your screen size is smaller than the room, you need to make a camera that follows the player using the view tab. To do this, make sure you have these boxes ticked at the top of the view tab

Then under Object following, select the object you want to follow (like your player) and set Hbor to 512 and Vbor to 512 (I have no idea why but this centers it in the middle of the screen it’s an old trick my friend taught me I never bothered to learn why it works)

Physics allows you to activate physics in your room using GameMakers built in Box2D physics engine.

Tiles is editing parts of the map that don’t use objects. For example if you have grass and sand tiles that don’t actually affect gameplay you would use tiles instead of objects because tiles don’t use any memory like an object does.

Settings allows you to set the room name and size, as well as the room speed which is the FPS the room will run at. I would reccomend 30 or 60 for room speed.

Objects allows you to place objects in your game world. One of the newer things with GameMaker:Studio is you can stretch them and set certain properties like their alpha and rotation. Which is pretty neat


Objects are what contain all the code ran in your game. Some objects wont have any code and will just act as solid barriers, some objects will be seen in game, some won’t. Objects are pretty much everything. They play the sounds, they change the rooms, they run the scripts. 

To break down everything about what an object is, let us first start by creating a new object and naming it obj_player

  1. This is where you can select what sprite the object will use. Some objects don’t need a sprite like a camera object or an object that spawns enemies.

  2. The two important settings here are visible and solid, which allows you to make a sprite invisible/visible or make it solid/not solid. 

  3. Depth is the position the sprite will be drawn on the screen. The less the depth the farther up it will be be drawn on the screen. For example, if an object with a depth of 20 and an object with a depth of 0 are standing on the same spot, the object with depth 0 will be shown on top.

  4. If you set a parent object, this object will inherit everything about that object. It is VERY useful for organization. If you keep all your say- items under ONE parent then you can easily reference all of your items in your code.

  5. Masks allow you to set a different sprite to use for collisions.

  6. This allows you to add events to your object which is where your code will be ran (explained further)

  7. Actions ran on the selected event (explained further)


Events in GameMaker are the triggers that will run all of the code in your game. Whenever you are programming pretty much anything in gamemaker, you are going to need to understand what event you need to put the code under. It could be your first step when forming a plan on how to program something.

The most important events that you will probably use most often have been marked with * and then explained why they are important.

– Runs when object is created * This is important for initializing variables. For example, if you want to set your player speed you would put

player_speed = 6;

here. It  has many other important uses like anything that needs to be checked immediately as an object is created.

– Ran when the object is destroyed. For some reason I rarely use this.

– Use these to time events. Say I want to after 30 seconds, make the message “HELLO WORLD” appear on the screen. I would write:

alarm[0] = room_speed * 30 

Then you could put this code on the create event. Then click alarm 0  to and you can put the code you want it to run on the right

in the actions on the right.

in the code for alarm 0 you can put show_message(“HELLO WORLD”);  * This is important for timed events that you do not want to run instantly. It is also important for things that you want to be checked constantly, but perhaps not as constantly as the step event. For example, if you want to every 30 seconds display


you could set a repeating alarm by using

alarm[alarm number]=30;

at the end of the code on the alarm event. Then it would reset itself everytime it ran.

– Runs every game tick. When you go into a rooms setting and set the room speed, this equals the FPS of the room. So if your game is 30 speed (default) it runs at 30 fps and has 30 ticks per second. This means the code you put in step will run every one of those ticks. The step event is useful for things that must be CONSTANTLY checked, or things you want to happen every moment. 

You can also use it for keyboard_check to check the keyboard every moment. It works the same way as a keyboard event if you do that.  * This is important for things that need to be checked consistently every frame like player movement, collisions, if your health is at 0, if you are falling. If you need something to react instantly use the step event. 

– This is when you touch another object. In code, you can refer to the object your touching like this other so lets say you want to display the x coordinate of the object you are touching. On the collision to that object you can show_message(other.x); 

This is very useful for things like enemies touching you, walls touching you, bullets touching you …ect * This is obviously important because in most games you’re going to have to be checking when an object touches another object

– Runs the code while the key is pressed (will run over and over until you let go)

* Just a note, I prefer to use the step event instead of this event. Because you can use code like

if (keyboard_check(vk_left)==true){


//move left


to check if a key is being pressed in the step event

– Ran when mouse is clicked. You can use this for clicking directly on the object, or clicking anywhere in the game screen

* Same as the keyboard, you can check every mouse event in the step event by using


– Contains useful things like, game start, game end, outside room..ect

*Lots of useful stuff in this one

– This is important! If you put any code under the draw event it will not draw the sprite and will only draw what you code. You can use the draw event for:

Drawing the sprite with certain properties affected by variables

Drawing text

Drawing multiple sprites on one object *If you want to have anything dynamic in your game like fading images, images growing expanding, having clothes you can take on and off, or displaying text on top of a sprite, you are going to need to learn how to utilize draw.

– Runs the code only once when the key is pressed

* The step event equivalent is keyboard_check_pressed 

You also have key release, which is the same thing, only it is ran only once when the key is released.

– This one is new I haven’t used it yet. Looks interesting though.


Under the control tab, and then under code you want to use this little icon to do the scripts in your game. The other buttons are basically just easier ways and not having to write out code, but that is for noobs and honestly you won’t get nearly as much functionality so I recommend just jumping straight into code if you can.

So you can drag in this icon into the the actions and it will open up a code editor where you can begin typing code. Now, let us start learning about the basics of programming.

Coding in GML (Game Maker Language):

Some important concepts to know before we delve in:


Variables keep track of things. Your speed, your name, your x coordinate, your sprite. These are all variables that can be changed at any time. You can name a variable anything and they are defined in code like this

variablename = 6;

This would set the variable “variablename” to equal 6. Notice the semi-colon at the end. I would recommend putting this at the end of every line of code you write to keep it organized.

GameMaker has a ton of built in variables associated with every object you created like:


As well as global variables like


You can perform arithmetic on that variable in code to instead of just giving it a value. For example, if I want to add one to the score it is like this:


You first put the operator you want to use:

  • = addition

  • = subtraction

      /      = division

      *      = multiplication

First the operator, then an equal sign.

So to divide variable health by 2 we would do



Built in functions are what GameMaker is so handy. It includes so many functions that save you time and effort. Instead of looking back through your high school algebra I homework to find the point distance formula, you can use built in GameMaker functions like:


That function returns an object's distance from a point (you provide the points x and y). 

You can create your own functions too, by using scripts. Say I wanted to create a script that added 5 to a number, and then returned the value.

I could create a script called add_number and on that script put


To break this down, it starts out like this


This shows our function is going to return a value. In this case the value is going to be whatever number you provide the function +5. You can have it so your scripts take what are called “arguments” which are basically inputs for your function. In this script I have put argument0+5. The reason the first argument is not argument1 and is instead argument0 is because computers count from 0. I could then call this script in my code like this:


And it would return 12, because 7+5=12. To display 12 on the screen. We can use the built in show_message function


If Statements:

If statements are how you check things. Basically how it works is:

if this

do this

so, we can check any variable, for example


if score is equal to 100

then go to next level

if health is less than 1 

then restart level

if speed is equal to or greater than 88mph

then time travel

You can check if a variable is equal to, equal to or greater than, less than, if the value is NOT something, like say we want to make sure speed is not 0

if speed is not 0

play moving animation

This would make it so that if the speed was NOT 0 (basically if you have any speed) it will play the players walking animation.

So, now that you have seen how they are structured, let us see how you would go about actually writing it out.

The layout is like this

if (variable operator value){

code you want to run


I will break this down piece by piece. 

The variable is the value you are checking, it can be anything from speed, health, what sprite you are using, your x, y any value you want to check

The operator is what kind of check you wish to perform. There are a few different checks we can use here. Whatever operator we use, it will compare the variable to the value using this operator.

== The value  is exactly equal to the variable

<   The value is less than  the variable

>   The value is greater than  the variable

!= The value DOES NOT equal  the variable

<= The value is less than or equal to the variable

>= The value is greater than or equal to the variable

And finally, we have the value itself, which can be anything from a specific number, to even another variable itself! So, let’s see some examples.

if (sprite_index != spr_wall){

code to run


This checks if your sprite is NOT wall, if it isn’t wall, it will run the code.

How would we write a script that checks to see if your score is greater than or equal to 100?

if (score >= 100){

code to run


Another beautiful thing about the if statement, is we can throw on and else statement at the end, and it will run the code under else if the condition is not met. Here is what that looks like:

if (variable operator value){

code you want to run if condition IS met


code to run if condition IS NOT met


So, say we want to make it, so if your health is over or equal to 50, we want you to look normal, but if your health is less than 50, we want to make it so your sprite is a damaged player.

if (health >= 50 100){

sprite_index = spr_normal;

} else {

sprite_index = spr_damaged;


If statements are going to be extremely important whenever making a game.

Putting these concepts together:

Now it is time for your first project in GameMaker before you learn anymore let’s try to use what we have just learned.

Start a new GameMaker project and name it whatever you like. I will be naming mine Tutorial1. 

First thing we want to do is create a new sprite for our player. Right click the sprites folder and create a new sprite, name it spr_you and click edit sprite. In the sprite editor, click file and then new and it will ask you how big you want the sprite

For now we will keep it at the default 32×32, but that is relatively small. Typically I prefer 64×64 for basic games because this allows room for more detail. 32×32 will be fine for this quick project, it will make it faster to draw your player. 

You should now have a new image called image 0. One thing you are going to learn about computer, they like to start counting from 0. Double click on image 0 to open up the sprite editor and then doodle your heart out! Don’t care about making it look nice, this is all just for fun.  You will probably want to zoom in for more accurate drawing using scroll wheel. I won’t go into detail on how to draw using the sprite editor, it’s like ms paint but slightly better.

Now that we have the picture for our player, we need to create an actual object for our player so they can use that sprite. The same way we created our sprite but this time with the objects folder, we want to create a new object and name it obj_you and set the sprite to spr_you using the drop down menu.

Nicely done, now, finally. We need a room to contain our game. Right click the room folder and create a new room.  You can name it rm_game if you’d like, then click the objects tab on the left, and make sure obj_you is selected, now you can left click anywhere on the grid and place your player in the room.

Nicely done, now we are ready to test it! Back in the main GameMaker window, check the top bar and make sure target is set to Windows and click the green arrow button

And… let it compile for a bit, and it should run and you should see your player sitting in an empty grey room like this:

Kind of boring, right? But it is the start of some amazing stuff soon to happen. You can exit out of the “game”, there’s nothing to do right now, no controls, no code, no if statements, no variables (other than the built in one) AND we are going to fix that. 

Let’s start off by adding some simple controls, shall we? 

Now before we make the controls, you need to understand how grids in GameMaker work, they aren’t exactly the same as what you learned in math class. 

This is the grid you know:

As you can see, the farther we go to the right, the higher our X value is, and the more we go up, the higher our Y value is. Now the difference in GameMaker is, the                                                                                                                           –    Y value is reversed. So instead of Y going higher as you go up, the Y value goes down as you go up, and increases as you go down. You can imagine it the same way as you normally see a grid, only upside down. The reason why this is, is because you start out from the top-left of the screen, so the top left of the screen is 0,0. 

So imagine GameMakers grid like this:

Where the green are the positive values, and red is the negative values. If we want the player to move up, we subtract from Y, if we want the player to move right, we add to the X. This might be a bit confusing at first, and believe me, I still make mistakes with it all the time. Don’t trip dog.

Now that we have all that grid stuff out of the way, let’s go back to our player object. So we want to add movement, and there’s a ton of different ways to do this. Movement in a game is interesting, the two main ways to move in 2D space are with either the mouse, OR the keyboard. For simplicity we are going to just use the keyboard, just keep in mind this is certainly not the only way.

So first things first, we need to add an EVENT to hold our code. What event should we use in this scenario? Well, why don’t you go back up to the events section and take an educated guess.

If you guessed the keyboard event, give yourself a pat on the back buddy!!!!!!!!!! That is exactly what we are going to use. But we got to think, we have a few different keyboard events… 

“WHICH ONE DO I USE!?!” you yell spitting violently into my face. Well, let’s think about it. If we use the keypress event, it will run our movement code when we press the key. Sounds good right? Only issue, you have to keep violently pressing the button over and over if you want to keep moving.

Well, what about key release? Same thing as key press, only it will move when you let go each time. BUT Keyboard event will CONSISTENTLY run the code AS you hold down the key. So our players don’t have to break their mommies dell laptops keyboard trying to move around in your game. 

Now, there are some things you WILL want to use key press or key release for. For example, if we want to have our player shoot a pistol, we don’t want it to keep shooting over and over as you hold down the key, we would probably want it to shoot when we tap the button. Or if you have a button that enables/disabled something you won’t want it to keep rapidly enabling disabling itself as you hold the key down, you would just want it to enable/disable once when you press the key.

So go ahead and click keyboard, and select the left key at the top. Now, it should look like this on your object:

It’s a solid start, but, notice that our actions are empty. We need to have something actually you know, happen when you press that key. So, we want to go to the control tab as we went through earlier and drag out the code box here:

It should then pop up with the code editor, and now we can begin typing what exactly happens when we press the good ol’ left key. 

So referring back this grid earlierWe need to take a look and think about what we are doing here. We know that the line going up and down is the Y axis, and the one going left to right is the X axis. Since we are using the left key, we want our player to move left, so we look at the left side of the X axis and notice it is red, which MEANS it is negative. We need to subtract from our X value to move to the left. 

If you read the variables section, you should know that to subtract from a variable, you write it out like this:


Where amount equals whatever “speed” you want to move at, because the more this value is the farther left you will move. I’m going to make mine 1 so my player is very slow.

We can now press that green arrow, launch our game and see if it works.

You can see why it was a good idea to not use the Keypress event, imagine having to rapidly hit the left key OVER and OVER every time you wanted to move just 1 pixel to the left. If you want, you can right click the keyboard left event and click change event, then set it to key press left just to see how awful that would be.

Now, using this knowledge and using the grid provided, you should be able to make the rest of the movements. Where Right would be positive on the X, Up would be negative on the Y, and Down would be positive on the Y. Like this:







Feel free to substitute the 1’s with whatever value you prefer. And make sure the grid  makes sense to you! So, if we test it out in game now, we should be able to move our player in all directions as well as combine directions (like up and left) to move diagonally. If a key is moving you in a weird way, check to make sure the code on it corresponds correctly to the grid. 

If everything works correctly, you should have your basic movement system down. And you will have one happy player being able to move in whatever direction they please with straight-forward controls!


So you now know how to create the most simplest form of top down movement. Let’s add some barriers into our game, it will help you understand if statements as well as how solid objects work in GameMaker.

Create a new sprite and draw a simple wall, you can use the fill bucket to make it entirely one color, or draw something fancier if you want. My wall is 32×32 and I will be naming it spr_wall

Then you can create an object and name it obj_wall and attach the sprite for it, then we will tick the solid tick box here:

Now you have a solid wall, open up the main room of our game and place some walls around and test your game to see if your player can walk through them.                                                                                                                                                                                                  

It seems our player is able to freely move through the walls even though we defined them as solid. Turns out it is a bit more work than that. We need to have a check on the player to make sure they don’t move through solid objects. The best time to do this is RIGHT before our player moves, we make sure the place we are moving INTO is clear.

So how it will work:

Is the movement key pressed THEN

Is the space empty THEN


If the movement key is not pressed OR if the space is NOT empty, then your player will not be allowed to move into that spot, HOWEVER if both those conditions are true then your player will be able to move into that location.

Let’s look at our movement code. 

So we have each key mapped out, and when those keys are pressed it moves you on the x or y axis a certain amount. Real quick I have a recommendation to clean our code up a bit and make things easier for us in the future. On each key press we have say:




The values at the end the numbers we put in are how many pixels we are moving, but since they are all the same (we don’t want you moving 5 pixels at a time moving up, but 3 going left thats inconsistent and weird) we can use a variable called pspeed to keep track of our movement speed. So on each keypress instead of:


you would have:


Go through each keypress and change the numbers into the word pspeed. 

So now that we have each movement using pspeed we need to define exactly what the variable pspeed equals, and we have to define it BEFORE we do any movement. For example, if we define 


10 seconds after the game start, or AFTER you press the W key, then when you try to move it will throw an error because pspeed is undefined until then. So we need an event called the Create event. This will run the code AS soon as the object is created.

The create event is SUPER good for defining variables before they get used by your object. Inside the create event, we can drag out a code action and type in:


Or you can replace 5 with whatever speed you want. In the create event we can also define other variables like 




You don’t actually have to put these, but you can see how we can define any variable name and give it a value in the create event. You can set the health, level, speed, mana, and give it any name you want. Just use this format. For now though, the only variable you need to give a value is pspeed. Once you have it set to a certain value go ahead and run your game to see if it works.

So what is the benefit of having this pspeed variable instead of hard coding each number into each movement event? Well, say we want to increase our speed, or decrease it. We can now easily do that by subtracting or adding to our pspeed variable and it will change it in each of the movement events easily. Also it is going to help us code our check to make sure our player isn’t walking into solid objects.

Go ahead and open up the left movement code, you should see this:


We are going to put an if statement around this, and the if statement will have to be true in order for it to allow the movement. The statement we are going to check is a built in function called


Create an empty line before the x-=pspeed and type:

if( place_free(

Notice after we type place_free(, if you look at the bottom of the code window you will see this

As well as being able to google “place_free gamemaker” to get documentation on the built in place_free function, we can see here at the bottom that place_free takes two values, an x and y value. This is very useful if you need to remember what values a built in function, but if you really wanna learn about it I recommend googling it and checking out yoyo’s documentation

We can read here that this function will check if an area has an object with the solid tickbox checked. The x and y position we provide it will be where it checks, and we want to provide the x and y position of where we are ABOUT to move into to make sure it is clear.

So let us think, where are we about to move into? What are the x and y coordinates we are about to move into? Let’s look at this line:


So we need to provide an x and y, and it looks like our y won’t be changed at all, and our x will be subtracted by pspeed, we write it out like this:

if (place_free(x-pspeed,y) )

 I highlighted the x in green, and the y in red. As you can see, for the y coordinate we are checking we can just enter our current y because that will be the same, for the x coordinate we enter our current x MINUS pspeed because that is where we are trying to move, and you don’t put -= you just put – because the -= is for when you are changing a value, this is just for checking. 

Now we just need to brace it up, and what is inside of the braces is the code that will be run if the condition is met, also we can make sure the function returns true. That will look like this:

if (place_free(x-pspeed,y)==true ) {



If you remember under if statements, we can use == to check if the function returns EXACTLY true. It will return true if the place is free, and false if it isn’t. We could also write it like this:

if (place_free(x-pspeed,y)!=false ) {



And this will check if it DOES not equal false, which is the same as checking if it is true. So, now that we have it all written out this is what the left movement code should look like in your code window:

Also note that the spacing in the fir nost line is not actually needed, you can slam it all together like this if you 


GameMaker is rarely strict about anything spacing, capitalization, formatting, semicolons so there’s freedom to organize your code how you like it. The way I do it is one of a million.

So, now that we have our left movement code checking to see if the place is free before moving, let’s test it out by walking DIRECTLY left into a wall.

You will notice that you can go down into a wall, but if you try to walk directly left into a wall it will stop you. So, let’s take our place_free line and reformat it to work with all the other directions.

The next movement code down the list is up and the code for it is:


Copy and paste the place_free line from the left code over the top, and put an end brace at the end so it looks like this:

if (place_free(x-pspeed,y)==true ) {



Now we have to reformat the first line so that it works with the up direction. This time, our x will be unaffected and our y will be subtracted by pspeed, this will look like 


See how this works? You just keep the value that is unchanged by itself, and then separated by a comma on the other side, you have the value that is added or subtracted by pspeed. In case you are having trouble formatting any of them here is a list of what each directions place_free should look like:

Only use this if you have to! Try to figure it out on your own!









So if everything was coded properly, our player should now never be able to move into walls because each time he moves it checks to make sure the place he is about to move into is free. One small thing you may notice is that ou itr player has trouble squeezing in between walls, and this can easily be fixed using a custom mask for our player. See because our player is the exact same size as our walls, he has to FIT pixel perfect in between them to get through, what a mask would allow us to do is make it so our player is actually slightly smaller than the walls so it doesn’t have to be exact, but is still displayed as being just as big on the screen.

To demonstrate this in action take a look at this:

The red square represents the mask on our player


 If we use a smaller red square for our player mask, we can see how it’s easier to squeeze through

There’s multiple ways to set a mask, you can either use a sprite or you can open up the spr_you and click modify mask

This is something somewhat new to GameMaker at this time, not extremely new, but some people might prefer just making sprite masks. I will use this method since I am assuming it will be the newly accepted method of doing masks and it has a decent amount of customization. 

So we can see we have a left, top, right, and bottom value, and in the yellow square we can see what our current mask is by the transparent grey overlaid over our sprite. The rasta flag was added by me in post-production. 

The values in red, we want to add 3 to, and the values in the green, we want to subtract 3 from, this will tighten up the square in the yellow square like so:

You can see here now how the box has tightened up and it will be less big when detecting if it is touching something (by the way the touching part is called a collision in GameMaker) and it will still display our sprite normally in game. Let’s test it and see if we can slide through those areas easier now.

Awesome! Now we can create some sort of goal, go ahead and draw a flag, and name it spr_flag and create an object called obj_flag and on obj_you we can create a new event and click collision, then click obj_flag

A collision event if you read above basically means it will run the code when it touches that object. So when we touch the flag, we want to move to the next room. I am going to teach you something kind of cool here, so create the event collision to obj_flag then drag out a code action.

Start out by typing 


And you will see a list of all functions beginning with room_ and you can use your arrow keys or mouse to scroll through them. This is extremely useful if you want to explore new built in functions/variables or if you forget the exact name of something. If we scroll through we will find room_goto_next() go ahead and press enter on it or click on it and it will put it in. You can see here at the bottom it doesn’t take any arguments

So you can just put (); at the  end of it like this:


And now, when your player touches the flag, it will go to the next room. Go ahead and set up a simple maze for your player to walk through with a flag at the end. You can go into the room settings to change the room size if you wish. 

If you touch the flag, GameMaker will throw an error saying that there is no next room, so we need to create a second level. Right click the room folder and create a second room for testing purposes and then replay the game to make sure the flag works correctly.

So if everything is working correctly, when you touch the flag it should shoot you over to the next room. Now, if we want we can go ahead and create many maze levels with increasing difficulty and call it a game send it off to EA add a little bit of DLC and retire, however, if you are truly passionate we could add a little bit more. What about obstacles, enemies, points? So many options, infinite possibilities. Hidden walls, traps, speed boosts, we could take this just about anywhere. 

Let’s try creating an obstacle. I am going to create a simple 32×32 flame sprite named spr_flame, and then make an object called obj_flame with the sprite

Now when the player collides with this flame, we want some sort of action to happen. We could have our player restart to their start position, or simply restart the room to give the same effect. 

With our obj_flame (or whatever you gave your obstacles name) we can now go onto our player object and create an event for when we collide with the obj_flame. (If you don’t see the obj_flame in the collision list, make sure you didn’t just create the sprite but also made the object)

Now we can drag out our code action and once we are in the code editor, we can type the code that runs when we touch the flame.

To restart the room, you may remember how we used room_ to find room_goto_next, and we could scroll through to find the correct function for the job. You can do that here to, try to find what built in room_function will restart the room.

room_restart will do just that, and we can see at the bottom it doesn’t take any arguments. So simply putting 


Will work. Notice how we still have to put the parentheses for the function even though it doesn’t take any arguments.

Now on our second level, we can go ahead and make a simple level with obstacles you must avoid.

Go ahead and test the game, and remember the second flag will throw an error because there is no room past the second one (unless you created one)

Now it may be unfair to instantly kill the player on one touch, and for the future of our game it may be a good time to implement health! This will also give you some experience drawing text to the screen (you ain’t ready for none of them fancy health bars) 

Leave a Comment

Your email address will not be published. Required fields are marked *

/* add by OCEANUS */