AndrewRenn
04-16-2009, 11:17 PM
Hey guys, I'm new here, and I just had a pretty simple question.
I am working on an inventory 'system' type deal, where when the character moves over the items, it goes into the inventory (any inventory) depending on which one is full, in order of inventory.
I have three inventory spots right now, one with the instance name of inv1, and the others with inv2, and inv3.
Heres my problem though; I want it to basically update every time an item goes into the inventory, i.e. I walk over an item, and it goes into inv1, then I walk over another item later, and it goes to inv2, etc.
I have that basically, but I can't get it to work right, heres one way to do it, but then it goes to the same inventory instead of updating.
onClipEvent (enterFrame) {
current = "inv";
currentInv = "2";
cur = "";
if(_root.Character.hitTest(this)){
cur = current + currentInv;
this._x = _root.inv2._x;
this._y = _root.inv2._y;
trace(cur);
}
}
I just have it trace cur to see what cur = for now, but anyways.
with the
this._x = _root.inv2._x;
this._y = _root.inv2._y;
It basically moves it to the inv2 x and y positions. I want it to do that, but yet, I don't want it to, I want it to use a variable to do it, so I can just update the variables and it will 'automatically' know which one to go into.
That is why I ahve current being inv and currentInve being 2, so when you combine them (with cur), it makes "inv2" and then I could just add soething saying currentInv ++; which would increase it by one.
So basically, I can't get
this._x = _root.inv2._x;
this._y = _root.inv2._y;
the _root.inv2 to be _root.cur, because then it just doesn't do anything
Any help would be appreciated! Thanks
I am working on an inventory 'system' type deal, where when the character moves over the items, it goes into the inventory (any inventory) depending on which one is full, in order of inventory.
I have three inventory spots right now, one with the instance name of inv1, and the others with inv2, and inv3.
Heres my problem though; I want it to basically update every time an item goes into the inventory, i.e. I walk over an item, and it goes into inv1, then I walk over another item later, and it goes to inv2, etc.
I have that basically, but I can't get it to work right, heres one way to do it, but then it goes to the same inventory instead of updating.
onClipEvent (enterFrame) {
current = "inv";
currentInv = "2";
cur = "";
if(_root.Character.hitTest(this)){
cur = current + currentInv;
this._x = _root.inv2._x;
this._y = _root.inv2._y;
trace(cur);
}
}
I just have it trace cur to see what cur = for now, but anyways.
with the
this._x = _root.inv2._x;
this._y = _root.inv2._y;
It basically moves it to the inv2 x and y positions. I want it to do that, but yet, I don't want it to, I want it to use a variable to do it, so I can just update the variables and it will 'automatically' know which one to go into.
That is why I ahve current being inv and currentInve being 2, so when you combine them (with cur), it makes "inv2" and then I could just add soething saying currentInv ++; which would increase it by one.
So basically, I can't get
this._x = _root.inv2._x;
this._y = _root.inv2._y;
the _root.inv2 to be _root.cur, because then it just doesn't do anything
Any help would be appreciated! Thanks