PDA

View Full Version : [AS1] How do I make MCs pass behind one another so as to give a simple 3d effect?


tech1495
07-03-2009, 03:14 AM
Hey All,

I'm making a basic 3d platform shoot em up.

I need a fairly simple script (swapdepths or suchlike) to place on a number of different movie clips so that when they rise up the y-axis, and when one MC rises above the other, it moves behind it so as to give the required 3d effect.

I'm fairly new to actionscript and am struggling a little here.

All help greatly appreciated.


Rick

rrh
07-03-2009, 06:58 PM
I've done something like this in AS3, where I sorted an array of the objects according to y value, and then for loop through them, adding them as they go. Of course, AS3 uses addChild instead of swapDepths.

If we're trying to do it live, like on every frame, I might use a bubble sort, since it's pretty efficient running on something that's almost or completely sorted already.