View Full Version : [FMX] duplicated MC's interaction
tgelston
April 7th, 2003, 11:37 AM
What is a simple method for getting duplicated movie clips to
interact?
I want two duplicated clips to do a hittest on each other. An
asteroid and a laser. I can use this. on one of the objects but how
do I pick up the name of the other object - it could be anything from
asteroid1 to asteroid100.
Thanks,
Tobias
senocular
April 7th, 2003, 12:57 PM
you need to use loops and actually loop through each one of those 100 asteroids and check to see if there is a hitTest with each lazer beam to each asteroid.
If you have a lot of asteroids and a lot of lazers, this can get to be a very slow process. There are techniques to optimize this kind of interaction using clip layering and tile operations but your best bet is using the loop. If that proves to be too slow, you might want to try something else.
lazerBeam.onEnterFrame = function(){
for(var i=1; i <= 100; i++){
if (this.hitTest(_root["asteroid"+i])) trace("boom");
}
etc.
tgelston
April 7th, 2003, 01:02 PM
That was what I was thinking - I am glad to see I am learning :)
Thanks for your help.
Where in Maryland are you? I am in Gaithersburg in Montgomery County!
senocular
April 7th, 2003, 01:13 PM
I work in Columbia but live in Westminster :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.