[SOLVED] Grouping Movieclips - AS2

Subscribe to [SOLVED] Grouping Movieclips - AS2 1 post

Sign in to reply


 
avatar for Dealmaster13 Dealmaster13 502 posts
Flag Post

I have a tank which is made up of 3 parts:
A body
Tracks/wheels
A turret

My game will have many tanks at any one time and various combinations of tanks, so what I want to do is group a body, a track, and a turret into a single empty movieclip called "tankParts"+i.

I need to avoid using an array as these 3 parts need to act in sync.

This ["tankParts"+i] needs to be in another empty moveclip called myTanks.

Would this work?

I can’t seem to be able to attach the 3 movies to ["tankParts"+1] which is attached to myTanks.

If the above can work somehow, what would the code be for attaching ["tankParts"+1] to myTanks and then the body, tracks and turret to myTanks["tankParts"+1]?

This is what I have so far which doesn’t work:

“myTanks”, root.getNextHighestDepth());
myTanks.createEmptyMovieClip(“tankParts”, _root.getNextHighestDepth());
myTanks.createEmptyMovieClip(“tankParts”, _root.getNextHighestDepth());
myTanks["tankParts"+1].attachMovie(“stdBody”, "stdBody"+(myTankCount+1), myTanks.getNextHighestDepth(), {
x:100, y:200});
myTanks["tankParts"+1].attachMovie(“stdTracks”, "stdTracks"+(myTankCount+1), myTanks.getNextHighestDepth(), {
x:100, y:200});
myTanks["tankParts"+1].attachMovie(“mchn”, "mchn"+(myTankCount+1), myTanks.getNextHighestDepth(), {
x:100, y:200});
myTanks["tankParts"+2].attachMovie(“stdBody”, "stdBody"+(myTankCount+2), myTanks.getNextHighestDepth(), {
x:300, y:100});
myTanks["tankParts"+2].attachMovie(“stdTracks”, "stdTracks"+(myTankCount+2), myTanks.getNextHighestDepth(), {
x:300, y:100});
myTanks["tankParts"+2].attachMovie(“mchn”, "mchn"+(myTankCount+2), myTanks.getNextHighestDepth(), {
x:300, _y:100});[/code]

Thanks a lot in advance!

SOLVED
It was an issue to do with depths… yet again

Sign in to reply