stack - Flash AS 2, Stacking items in the players inventory -


i have inventory names, , numbers names increase more of same items added.

item code:

_root.player_inventory = new array(_root.array);  (a = 0; < _root.invslots; a++) {     _root.player_inventory[a] = "none"; } 

stacking code:

_root.player_inventory[a] = new array(_root.stackamount);  (b = 0; b < _root.stackamount; b++) {        _root.player_inventory[b] = 0;     //player_inventory[a][b] = "[" + + "][" + b + "]";       //mainarraytxt = "[" + + "][" + b + "]";      //b = 0; } 

my item code fine; add stacking it.

enter image description here

i got code tutorial: http://www.newgrounds.com/portal/view/448642

one way of doing is:

item code:

_root.default_items = ["food","torch","sword","map","hatchet"];  _root.player_inventory = new array(_root.array);  (a = 0; < _root.invslots; a++) //fill inventory spots "none" {     _root.player_inventory[a] = "none";  }  (a = 0; < _root.default_items; a++) //set first spots default items {     _root.player_inventory[a] = _root.default_items[a]; } 

stacking code:

_root.default_stack = [10,1,1,1,1];  (b = 0; b < _root.player_inventory; b++) //set amount default stack or 0 {        if(_root.player_inventory[b] != "none")     {        _root,player_inventory[b].push(_root.default_stack[b]);     } else {        _root,player_inventory[b].push(0);     }  } 

in end _root.player_inventory array have values like:

_root.player_inventory[0][0] returns food _root.player_inventory[0][1] returns 10 

unfortunately can't test code bcause flash version old, general idea.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -