PDA

View Full Version : controlling duplicates



alzor
February 26th, 2005, 03:43 PM
http://www.ikickedmydogintheface.bravehost.com/smashtv3d.html

hey everyone I am going to ask this question again...maybe you guys could help? I seem to be having a problem with the depth here, and Ive tried a few things such as:
["teletubby"+i].depth=["teletubby"+i]._xscale*["teletubby"+i]._yscale/2;
thinking that this line of code would automatically assign the highest depth to the biggest teletubby (meaning that the smallest guys stay in the back and everything doesnt look all wierd). this didnt work. I then tried some other things but they proved counterproductive does anybody have ANY idea about what to do?
also is there any particular way in which to control individual duplicates of movie clips when there is a function that infinitely duplicates movieclips? can anybody help? thanks in advance.

Marz
February 26th, 2005, 04:28 PM
["teletubby"+i].depth=Math.ceil(["teletubby"+i]._xscale*["teletubby"+i]._yscale/2);
["teletubby"+i].swapDepths(["teletubby"+i].depth);

alzor
February 26th, 2005, 07:10 PM
thanks mars! I knew I wasnt TOO far off on that....
now is there anything special involved in controlling duplicates? because I was writing a little plane game a long time ago and I figured I would write some new stuff into it but I was having trouble....ehh whatever Ill ask you guys for help if I need any in the future.for now dont worry about it.

Marz
February 26th, 2005, 07:20 PM
When controlling duplicates... I would suggest doing it in this method...

_root.myPlanes = new Object();

_root.myPlanes["plane"+i] = _root.planeart.duplicateMovieClip("name"+i, i);

If you do it this way... you can access each plane by doing...



for(var grab_plane in _root.myPlanes)
{
_root.myPlanes[grab_plane]._x += 5;
}


Or something along the lines of that. :) There are hundreds of different methods. I just find that this is the fastest and easiest to tell you the truth.

alzor
February 26th, 2005, 07:31 PM
ohhhh so there is a method of going about it... I bypassed this stuff when learning actionscript because ...well I dont know why...hmmm. can you think of a good tutorial that would give me the general concept?

Marz
February 26th, 2005, 07:40 PM
I'm working on some actually... But search around the forums for objects... That might help you some.