• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker I'm trying to create inventory

L

LiorLiorLior

Guest
I wore a code in which every item in the inventory makes Item_add = 1, the inventory creates it inside, then polls the list. The problem is that all things are created in the first cage of the inventory, I don’t know how to make each new thing coexist with the next cage.


CREATE:

Item_add=0

global.inv = ds_list_create()
global.LANGUAGE = "eng"

enum item
{
armor_1,
armor_2,
sword_red
}

itemSprite[item.sword_red] = object_sword_red //sprite4
itemSprite[item.armor_1] = object_armor_1 //sprite5
itemSprite[item.armor_2] = object_armor_2 //

STEP:

if (Item_add = 1)
{
for(var i=0; i<ds_list_size(global.inv); i ++)
{
var arr = global.inv[| i];

var item = arr[0]

instance_create_layer(470+ 32*i, 660, "HUD_o", itemSprite[item] )
//draw_sprite(itemSprite[item], 0, 616, 864 + 50*i)

Item_add-=1
ds_list_clear(global.inv)
}}
 
L

LiorLiorLior

Guest
This Script work is good :

var item = argument0

var n = 32
var r = 1
for (var e = 0; e <r; e ++;)
{
if (position_empty(470+(n*e),660))
{
instance_create_layer(470+ (n*e), 660, "HUD_o", item)
} else r++}

Thanks for myself!
 
Top