How do I make an inventory screen.

O

OriginalGrim

Guest
I'm trying to make an inventory for an RPG I'm trying to make but I have almost no idea what I'm doing I'm wanting to use DS_grid for this and have a sort of separate screen from the room the character is currently in. So my question is how do I make the grid and how do I make it so that pressing E will open it as well as there being something to look at (probably just a solid color for now). In the end I want it to look sort of like this but for now I just want to be able to open it even if there's nothing to do in it.
game inventory screen.png
 

PlayerOne

Member
Have 2 ds_grids 1 for items and for character stats then use a for a loop to draw your player stats on the GUI layer of your game window.

For example in drawing the stats screen.

Code:
//Create Event

stats = ds_grid_create(4,10) 
grid_w =  ds_grid_width(stats)
show_stats=false



//Step Event
if keyboard_check_pressed(ord("E")){show_stats=!show_stats}



//Draw GUI
if (show_stats=true)
{

//These local variables are used to draw the entire stats screen starting at the top.
var _xx = 75
var _yy = 75
var _space = 32
var _count = 0

for (var i = 0; i<grid_w; i++)
{

   draw_text(_xx,_yy + (_count * _space),"LVL" + string(stats[# i, 0]))
   draw_text(_xx,_yy + (_count * _space),"Name" + string(stats[# i, 1]))
   draw_text(_xx,_yy + (_count * _space),"Other" + string(stats[# i, 2]))
   count++; 
}
}
Mind you this is just drawing the stats screen. The inventory system is whole other beast especially if you intent to have separate inventories for your characters. I haven't tested this code and I might have written something incorrectly, but this is just to give you an idea as to how to draw your status screen when pressing E.
 
Top