GMS 2 - How to create an inventory Part 1 - Drawing Inventory on screen

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to my first gaming tutorial in this tutorial I'm going to show you how to create an inventory using game maker studio cue so let's begin first of all you're going to need two sprites one for the items and the second one for the inventory slot okay so you you'd like to have multiple images in sprite items sprite because this dose will be all the surface price of the inventory items you have to later use in the game so let's add an object which will control everything that happens in the game and this name in the object controller like that now we'll need to add a script that will initialize our inventory so initialize today okay we can have the script yet but we are about to write it so let's be patient that's great the script and name it initializes bantery as we have called it the whole so we'll need to pass few arguments in the script in this case is the X&Y position of the mentor II would like to have as well the size and the number of horizontal or vertical cells so vertical cells equals two first argument variable horizontal cells just Oregon oh yeah and this is one but I'm turning its I'm turning it from one now I need exact for y y equals argument three okay Oh [Music] slot size equals pew sprite to get wet slide front slide so in this case it will take the wit this pride which is 30 32 and this is well behaved because we're having squares as inventory you know so you'd always like to eat squares in the pantry not always but in most cases okay now we need to call a map in which we will store everything I mean all the cells all those positions that we were calling and stuff like that so global that inventory equals to D is read straight this rate this creates destruction in battery now I need to I mean discipline can be an T it will be like meaningless P and P vendor because currently it doesn't have anything it's like this map so let's go forward which will check for each individual horizontal vertical cell and add its position according to the number of the loop we are currently going through so J equals 0 Y a small horizontal cells one it to repeat for each nav Excel we got bar cell not equals TDS map great we want to store our xx and YY variables so let's called X xx equals u J because we are looking into the horizontal cells times slot size and of course let me to some little X good and let's do the same for y plus except we will of course ears instead of okay so our Mac shouldn't be anything right now so let's so let's add these values the map yes cell map Excel map ID of our idea course other size you will like and oh of course add items to this thing so let's add item id and spirit negative one this is that global that lantern and sighs sorry sell nothing I'm excited right now okay um yeah and that should be it that should initialize our inventory now we need to put the arguments side of it for and position where we are responding it is let's say rerun zero for instance but of course we need to draw it because otherwise we initialize it it won't only the values will be added to the system and nothing will be drawn on the actual game surface so let's click write script and let's make script or draw in run okay so what we will do here we will loop loop the entire inventory and check for the each individual cell after that we will draw each cell according to the values that we restored in cycle so how do we do that for a equals 0 is smaller than is about 300k x value equals x I know you not why okay now when you drop sprite on the screen sprite and run to slot zero that's a long way okay now we need to put a new event which is draw that and just add the following like that okay so let's just put our object in the room and that's the game okay the inventory has been successfully drawn to the screen in the second tutorial we will learn how to add items to this inventory and as well how to change their names how to create a drop option and equip option and stuff oh yeah please follow and subscribe to my channel and please use the link below to download the whole tutorial thank you very much for your time and listening bye bye
Info
Channel: bORKE
Views: 5,188
Rating: undefined out of 5
Keywords: gms, game maker studio2, gamemaker studio:2, gms:2, inventory tutorial, begginer, part 1 inventory, gmsdeveloper, gms 2, tutorial, gms 2 guide, gamemaker, game maker, inventory rpg, gms rpg inventory tutorial, yoyogames, gmstudio
Id: iAXojNd1KR0
Channel Id: undefined
Length: 9min 38sec (578 seconds)
Published: Wed Sep 13 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.