Hello and thanks for the help in advance. I am new to flash so bare with me. I’m having a little trouble and will try to explain the best i can. I have two visible movie clips…
player_mc, tree_mc
And two non visible (alpha = 0) movie clips…
playerHit_mc, treeHit_mc
I want it to look like the player goes through the tree when it moves over it. To do this i have set up a hitTest on the playerHit_mc and its x and y coordinates are set to follow the player_mc. When it hits the treeHit_mc the player_mc goes to the top. When it is not it remains in the back… giving the effect that the player goes through the tree. So far this code works fine.
onClipEvent (enterFrame){
this._x = _root.player_mc._x;
this._y = _root.player_mc._y;
if (this, hitTest(_root.treeHit_mc)) {
_root.player_mc.swapDepths(2);
_root.tree_mc.swapDepths(1);
} else {
_root.player_mc.swapDepths(1);
_root.tree_mc.swapDepths(2);
}
}
My problems are…
-
How do i get this to work with the tree being duplicated (lets say 20 times with random locations) to different depths. My swapDepths(1) and (2) wont work anymore.
-
If the tree is duplicated, how do i duplicate the treeHit_mc and get each one to land its partnering tree_mc.
-
I heard that when you use swapDepth it actually creates a duplicate and places it on the desired level (depth, whatever). Do i need to delete it when its not in use?
-
Or am I just dumb and there is a better way to go about this in general?