Building your first 2d game using Game maker studio

Building your first 2d game using Game maker studio

gml.jpg

Hey how are you doing?, this blog post is gonna be a text version of the live stream am gonna be hosting on my faceboook Coding example on sunday, So lets dive in...

What is Game maker studio?

GameMaker: Studio is a proprietary game creation system created by Mark Overmars in the Delphi programming language. GameMaker accommodates the creation of cross-platform and multi-genre video games using drag and drop action sequences or a sandboxed scripting language known as Game Maker Language, which can be used to develop more advanced games that could not be created just by using the drag and drop features. GameMaker was designed to allow novice computer programmers to be able to make computer games without much programming knowledge by use of these As you can see game maker studio has an inbuilt scripting language called game maker language and it supports drag and drop too. But in this case we will be working with the scripting part

What dies Game maker studio consist of? it consists of the sprite - game character object - character actions events sounds room -level and lot more, but we look more into sprite, objects and room

So open up game maker you should see a empty screen so you need to create a sprite hold on the sprite and click create new sprite give it a name, and click edit.. draw anything or anyone for your game character. Next click on object and create new object and assign the sprite image to it next we click on the action button and select steps the at the next drag and drop the script icon into it so let code this code is for the character movement

if(keyboard_check_pressed(vk_right)) { hspeed = 4; } what this code does is that it check if the right key was been pressed if yes then move the player with an horizontal speed of 4, so lets do the same for left up and down

if(keyboard_check_pressed(vk_left)) { hspeed = -4; } if(keyboard_check_pressed(vk_up)) { vspeed = 4; } if(keyboard_check_pressed(vk_down)) { vspeed = -4; } note vspeed means vertical speed now open up the room and click on the empty space to insert your player then test the game now you will notice the player aint stopping when we stop pressing the key, we can handle it like this

if(keyboard_check_released(vk_right)) { hspeed = 0; } if(keyboard_check_released(vk_left)) { hspeed = 0; } if(keyboard_check_released(vk_up)) { vspeed = 0; } if(keyboard_check_released(vk_down)) { vspeed = 0; }

as you can see all we did was call the released method and change all our values to 0 if you want a visual and better tutorial on this go to facebook, like my page and expect the video on sunday(live) Page : Coding example