Skip to main content
Participating Frequently
July 28, 2006
Question

How to detect collssion for random or Duplicated movie clips

  • July 28, 2006
  • 1 reply
  • 226 views
Hey guys .. i am back with set of query..till now .. key press movement a rocket (mc) is moving left right up down in a defined stage area. and i am able to generate some fire balls randomize falling from top. this is just i am duplicating the movie clip(fireball_mc) .... now i want incase or when the rocket (mc) touch the fire ball programm shold detect the collsion and generate a score board. well for this i have tried a script for two movie clips ... wchich is working but ..i don know or i m not gettng the logic how to detect the collission for duplicated movie clips... well i m just giving the script for oinly 2 movie clips coliding...can any one tell me how to do it with randmize or duplkicated mcs??

for 2 movie clip ...

_root.mc1.onEnterFrame = function() {
if(this.hitTest(_root.egg)) {
_root.result="Oh no..... we are dead";
} else {

_root.result="we are going fine";
}

}

(this is happening ..but let me know how can i get the same result for ranndom mcs)

hope someone can help me out ...

i appriciate ur valuable time to read this..

thanking you
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 16, 2021

either put your movieclips of interest in an array or name them so they can be easily referenced in a for-loop. eg, mc1, mc2, etc.

 

you can then use one enterframe listener/function to check all you movieclip hittests.