Classy Classy Inventory Code

Yay, a new and improved inventory system!  I’m very proud of myself, though I still need to implement accessors, a.k.a replace the ds_grid checks with ds[# x,y] calls as they look much cleaner.

function scr_additem(argument0,argument1,argument2){

     argument0 = item name
     argument1 = item sprite
     argument2 = item price
     with obj_player{
     for(temp_height = 0;temp_height<bag_size;temp_height+=1){
          if obj_player.bag[# 0,temp_height] == “empty”{
               return true
          if temp_height+1 = bag_size{
               feed_text = “You can’t pick up the ” + argument0 + ” You invintory is full!”
               feed_text_count = 120
               return false

Then i can use something like this in my pickup items collision with obj_player event!
if scr_additem(name,sprite,value) then instance_destroy()



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s