-
swapDepths not working
Hi,
I'm using this tutorial http://www.stormation.info/rpg-game-...torial-part-1/ to make a simple rpg game and the depth part is not working as shown.
(my character appears to be walking behind/under the other Movie Clips, even if those are on the same layer)
I can't figure out what's the problem because I'm just starting to work on flash..
so I would really appreciate some help. :)
-
Wow, i tried to help you. I did all the steps, made a simple character movieclip and the grass is a green rectangle, and i didn't achieve to set the Depths to it. Weird.
-
-
Hi,
PHP Code:
MovieClip.prototype.depthControl = function ()
{
this.swapDepths(this._y);
};
-
Thanks a lot! Now everything is working fine
but I have another little question...
What can I do with the clips that should be on the foreground?
because now my player can walk over everything I put on the stage, even on upper layers
and I would like some stuff to overlap it.
(sorry for so many newbie questions...)
-
Hi,
Yes, put the grass inside a movie clip of its own and change the code on the grass clip inside the new clip to this.
PHP Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.Character))
{
_parent.depthControl();
}
}
also call your little figure "Character", or change Character in the code above to what you have called your figure