U
uni00
Guest
Hello. We are making an inventory. The image is a picture of the item used for inventory. I draw a picture every 64 pixels. I want to use draw_sprite(); according to the order of enumerators below.
How can I make this sprite an enumerator?
How can I make this sprite an enumerator?
GML:
enum item{
none,
draw_set,
mirror,
ball_w,
ball_b,
ueki,
tubo,
tue,
kagi,
kami,
total
}
GML:
global.inv = ds_grid_create(4,2);
ds_grid_clear(global.inv,0);
var_slot=0;
var slot = 0;
while (slot < ds_grid_width(global.inv))
{
var inst = instance_create_layer(x+8+(20*slot), y+8, "Instances", obj_btn);
inst.var_slot = slot;
slot ++;
}
GML:
var iid = global.inv[# var_slot,0];
var amount = global.inv[# var_slot,1];
var name = global.item_index[# iid,item_stat.name];
var description = global.item_index[# iid, item_stat.description];
if(iid != item.none){
draw_sprite(spr_item, iid, x,y);
draw_text(x+4,y+9,string(amount));
draw_text(x+6,y,string(name));
draw_text(x+6,y+4,string(description));
}