|
-
[Problem] Inventory System not wroking? AS2
well i found an inventory tutorial on this very website and had to mod it around to fit my game, so i have this function
Code:
function addToslot(item1) {
var addItem1 = _root.backpack.attachMovie(item1, item1, 1);
addItem1._x = eval("_root.backpack.itemSlot"+currentslotnum)._x;
addItem1._y = eval("_root.backpack.itemSlot"+currentslotnum)._y;
currentslotnum++;
}
so that works, but when you start the game, i did this code
Code:
_root.warriorSprite10.addToslot("starterBladeI");
and that worked, starterBladeI went to the right slot, but then when i use this code to get another weapon
Code:
_root.warriorSprite10.addToslot("shortSwordI");
the shortSwordI goes to the second slot, but the starterBladeI disappears. anyone see an obvious error?
-
You are adding every item with the same depth!
Change this line
PHP Code:
var addItem1 = _root.backpack.attachMovie(item1, item1, 1);
to
PHP Code:
var addItem1 = _root.backpack.attachMovie(item1, item1, currentslotnum);
-
that worked perfectly thanks so much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|