Gamemaker Simple Game

by creativecooks in Circuits > Software

1815 Views, 1 Favorites, 0 Comments

Gamemaker Simple Game

instructables 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

Screen Shot 2018-07-31 at 11.52.39 AM.png
Screen Shot 2018-07-31 at 11.53.11 AM.png
Screen Shot 2018-07-31 at 11.53.32 AM.png
Screen Shot 2018-08-02 at 9.38.32 AM.png

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

Screen Shot 2018-08-02 at 10.37.02 AM.png
Screen Shot 2018-08-02 at 9.49.10 AM.png

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

Screen Shot 2018-07-31 at 11.57.13 AM.png
Screen Shot 2018-08-02 at 10.08.19 AM.png
Screen Shot 2018-08-02 at 10.09.01 AM.png
Screen Shot 2018-08-02 at 10.09.51 AM.png

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

Screen Shot 2018-08-02 at 10.41.41 AM.png
Screen Shot 2018-08-02 at 10.42.55 AM.png
Screen Shot 2018-08-02 at 10.43.18 AM.png

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

Screen Shot 2018-08-02 at 12.25.49 PM.png
Screen Shot 2018-08-02 at 12.25.59 PM.png
Screen Shot 2018-08-02 at 12.28.45 PM.png

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

Screen Shot 2018-08-02 at 1.05.16 PM.png
Screen Shot 2018-08-02 at 1.09.50 PM.png
Screen Shot 2018-08-02 at 1.31.22 PM.png

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

Screen Shot 2018-08-02 at 1.37.41 PM.png
Screen Shot 2018-08-02 at 1.39.43 PM.png
Screen Shot 2018-08-02 at 1.44.03 PM.png

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

Screen Shot 2018-08-02 at 1.58.24 PM.png

This code is pretty much the same as the code in the previous step, so just copy from the picture up top

Adding Gravity

Screen Shot 2018-08-02 at 2.01.22 PM.png

Right underneath hsp = move * walksp

Type vsp = vsp * grv

Jumping

Screen Shot 2018-08-02 at 2.15.08 PM.png

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

Screen Shot 2018-08-02 at 2.10.00 PM.png
Screen Shot 2018-08-02 at 2.07.01 PM.png
Screen Shot 2018-08-02 at 2.07.40 PM.png
Screen Shot 2018-08-02 at 2.08.15 PM.png

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

instructables game explanation

P.S.

I forgot to mention in the video that the create event happens only when the object is created