hi guys , i made an inventory for my game but the problem is that when i click and drag an object over the other one it overlaps it
so i want to know what to do to make it , when i click on an object, it makes it at the top of all the other objects in the inventory (makes it's depth the lowest it think)
I don't see any issues o.O can you explain better?
I drag and drop the items, and the dragged item always overlap (is always on top) the already placed items on the slots...
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
yeah i don't want the object to overlap the other one when it is put above it
i want it to go back to it's original place or slot when it founds another object in the place it was put into , see, i programmed it to go to the blue box i have drawn under the slots but sometimes it doesn't go to the box and it overlaps an object
That's a problem with some other code, not the depths, I guess it's not saying when a slot is full (setting a var perhaps), and without seeing the fla or any other code, then it's pretty impossible to predict.
What I do in that cases, is to use variables when the dropTarget or hitTest event happens that set a Slot to "occupied". I create the slots programmatically with a for loop and then I check for the occupied slot this way:
var Occupied:Boolean;
var defaultPosition:Number = draggedItem._x;
Basically the tutorial way is to create arrays from the start.
The onPress function checks/remakes the array status using the hitTest.
The onRelease function does the same again once released.
I did the change the tutorial a lot, especially to make it work like your original one, you could however decompile mine, if it is the last straw.
break; = stop/discontinue the current loop
continue; = skip this part of the loop and do next or something similar
As for _loc, there should not be any there, that usually appears within decompiled code in place of a var name, so you can swap all _loc* of the same value for anything you like, eg, name all occurences of _loc3 with myVar3 perhaps, and all _loc2 for myVar2.