Game Maker Studio: How to Create a Easy Inventory System for PC?
GMS File: https://rb.gy/dr71gd
Similar Video: https://rb.gy/wngtd5
Code File: https://rb.gy/ar3aid
Link on how to save a INI File, https://rb.gy/6zfls8
Note: 2/21/21: If you wanted to continue to the next room with your inventory you collected from the first room, you can do this. Make o_draw and o_global mark them as Persistent. Do not put o_draw and o_global in the next room, only in the first room. Then, when player moves outside room, say go to next room, then you would still have you're collected items. I just don't know how to save and load inventory yet. This means, when you exit game and go back to it, you will not have your collected items. So it works if you continue to play, but when you exit game, it will be gone.
Idea Example: You could have two levels, then at the end of the 2nd level, deactivate the o_draw and o_global, then the 3rd level could be a Bounce level, it would save there, then do a collision and hit something activating your o_draw and o_global which then inventory would be zero items, but you could recollect and move to next level with items collected in Bounce level. So when you exit game and load it back up you would be at the Bounce level with zero inventory, but recollect, before time runs out, then go to the next level with your items.
Note: You can expand on this, and add more weapon boxes if you like. I will be doing another video on inventory, but its for Android, and it could be used for the PC, just have to change somethings around, like don't show buttons, and using other button to select items with selector like the spacebar, so you can hide the mouse, while playing game.
Also, I found out how to hide the selector when you turn off the inventory. Instead of using the hide code, we are going to use the deactivate and activate code. So this will deactivate the selectors, and items, and activate the selectors and items. While its deactivated you can't use the up button to move through your items, which makes since, only when activated you can do so. Go to Global Game Setting, up at top near plus sign, Windows tab, uncheck Display the cursor. Update Splash to black screen. You can make a room for a Splash Screen, have a video on that. Graphics, check Interpolate colors between pixels, Scaling Keep aspect ratio, Allow switching to fullscreen, Size 2048x2048
For the Android video: I moved around the inventory items, adding a backing, and added one more item. Will show this weekend, if everything goes as planned.
So for....
btt_out_inv
Events:
Left Pressed
Actions:
instance_deactivate_object(o_select1);
instance_deactivate_object(o_select2);
instance_deactivate_object(o_select3);
instance_deactivate_object(o_global);
instance_deactivate_object(o_draw);
btt_in_inv
Events:
Left Pressed
Actions:
instance_activate_object(o_select1);
instance_activate_object(o_select2);
instance_activate_object(o_select3);
instance_activate_object(o_global);
instance_activate_object(o_draw);