Learning to make an RPG styled game in game maker Part 1

Learning to make an RPG styled game in game maker Part 1

So then , seen as though my new project outside of class with a few others is making a RPG style game i thought it would be beneficial for me to learn how to make the style of game we will be developing. This would benefit me because i will understand how to make a game , get me better at coding and also means that i can understand what the coding part of the team is talking about when they discuss coding the game, finally i can also then help with small things regarding coding like smaller jobs / tasks to improve the game that are less important then giant features of the game that they will be handling.

As mentioned in the other post i did , i am on the design team but like i said , it will help me to learn this and its also needed for my course to write about my progress in coding and as i have not done much code related blogs its about time i did.


 

To start work on this bit of education in game maker i have looked online (YouTube) for a tutorial playlist on how to make such a game and found a nice playlist made by a guy called “rm2kdev” . It is a 21 part playlist and i intend to watch it all and document it all on this blog. If anyone is interested in checking the  playlist out here is the link to part 1 :

 


Step 1 : Importing And Creating Sprites

First of all i was told to look online for a character sheet or have one made by someone , to save time i just got one online as our game sprites are not made yet and are still being done. Bellow is the character sheet i used.

Now i have a character sheet ready i need to head on over to the sprites section in game maker and create a new sprite. I named my sprite like so “sprite_dwarf_down”. I used the name dwarf for no important reason other than its a character in our game so if i need to reuse this code for the dwarf it was ready. From here i opened the sprite menu for the created sprite and selected “edit sprite” then “file” “create from strip” this gives me the ability to load a full sheet like the character sheet and select a row or column of images and use them. I selected the first 3 images on the sheet of the blue hair character and confirmed my sprite, from here i duplicated the sprite and renamed each to “sprite_dwarf_left” “sprite_dwarf_right” “sprite_dwarf_up” and changed the sprites to the set of sprites corresponding to the direction of the blue hair sprite would face.

Step 2 : Sprites Animation

Now i had to create the object for the character , this will old the animation for the sprite and also code corresponding to it. I created an object and named it “object_dwarf” i added a “create” event and gave it a ” execute code” action  with the following code

image_speed = 0.1;

This line of code sets the speed of the animation within the sprite toggling between the 3 images on each row.

I now have a sprite that would stand still but toggling through the”sprite_dwarf_down” animation.

Step 3 : Adding A Room

Now i need somewhere to put this sprite , i navigated over to the tab named “rooms” and created a room named “room_learning”. In here i set the dimensions to 1280 by 720 and also enabled a few options that i was instructed to like making the camera follow the sprite and scaling properties.

Step 4 : Sprite Movement

So then now we need to make the sprite actually move around the room ,by room i mean the level not a building’s room. I head on back over to the object “object_dwarf” and added a new event named “Step” within the event i added another “execute code” action and added the code :

///handle input logic

if (keyboard_check(vk_left)){
sprite_index = sprite_dwarf_left
x -= 1;
}

if (keyboard_check(vk_right)){
sprite_index = sprite_dwarf_right
x += 1;
}

if (keyboard_check(vk_up)){
sprite_index = sprite_dwarf_up
y -=1
}

if (keyboard_check(vk_down)){
sprite_index = sprite_dwarf_down
y+=1
}

What does this code do ? when reading that code you can learn what it does without the fancy words,  line 1 implies it handles inputs ,these inputs being ,you pressing a key makes it input that you have pressed it and takes an action. then line 3 shows that it checks if you press the vk(virtual key) left then : it wants the sprite to change to sprite_dwarf_left line 5 also shows that within this section of the code i am wanting the sprite to move “x-=1” so it wants the x position to -1 from its current position meaning the character moves left.

I repeated that little bit of code and changed the directions of movement and sprite accordingly to the direction it was moving.


GIF.gif

 


 

I now have a empty “room” with a sprite that moves left , right , up and down with walking animations.

That is the end of video one and i feel like i have made progress in game maker as it is the first time i have used it in 3 or 4 years and have forgot everything about it i am now going to start the next part of the playlist and will be posting a blog post of the next part.

 

Leave a comment