Gamemaker Simple Game
This game is a simple one (you probably know via the title). It has one block (which is you) and it also has the platform which is built up or another color block.
For this game you will need:
- A yo yo games account for access to Gamemaker studio 2
You however will not need the paid plans for Gamemaker.
Create a New Game
The first step is to create a new game.
For that you need to:
- Click New
- Click GameMaker Language
- Type what you want your game to be called
Change Fps
Usually the first step to creating a game is to change the fps (frames per second) to the desired amount. For us it will be 60.
To do that you have to:
- Open the Options tap on the right sidebar
- Click on Main
- Find Game frames per second and change it to 60
Create Sprites
Now that we have all our options all sorted out, we can get the game sprites and objects started.
To do that:
- Right click on the Sprites panel of the right sidebar.
- Then click on Create sprite
- Rename your sprite Splayer (the s in the front tells you that its a sprite)
- Click Edit Image
- Draw your player. For this example I use a green box which is perfectly fine for you to use too
- Repeat again for the wall. But this time name it Swall and color a gray box
Create Objects
Now that we have our sprites we can create objects for them.
To do so:
- Right click on the Objects part of the right sidebar and select Create Object
- Rename the object Oplayer
- Click No Sprite and select Splayer
- Repeat for Swall but name it Owall and assign it Swall
Set Variables
Now that all our objects are done we can start the coding.
The first step that we are going to do is set our variables
To do so:
- Select events in the Oplayer menu
- Click create
- Type the 4 variables shown in the last picture of this step along with the semicolon at the end of each line
- Change the 0.1 to a 2 (sorry about the miscalculation in the picture)
Start Moving
To start moving you need to:
- Create a step event
- Check when keys are pressed (see the code on the second picture of this step)
- Move when keys are pressed (see the code on the third picture of this step)
See all code for this step on the third picture
Adding Horizontal Collisions
Now that we have horizontal movement we need horizontal collisions
To do that:
- Right before the x = x + hsp add the new code that is in picture 1
- Now add the code that is in picture 2 (don't worry at the end I will go over what everything means)
- Now add the code that is in picture 3
Vertical Collisions
This code is pretty much the same as the code in the previous step, so just copy from the picture up top
Adding Gravity
Right underneath hsp = move * walksp
Type vsp = vsp * grv
Jumping
For the final section of code we will be jumping into jumping (ha-ha)
Just copy where and what the code is to finish the code
P.S.
Change the -7 to a -20 (sorry about the miscalculation in the picture)
The Map
For the final part of your game you need to make the map
Open the rooms folder and select room1
Then drag in all the walls you want (make sure to add a player)
What This Means
P.S.
I forgot to mention in the video that the create event happens only when the object is created