Skip to main content
Inspiring
April 11, 2013
Answered

Symbol as parameter

  • April 11, 2013
  • 1 reply
  • 274 views

Hey guys,

I have a function which takes two MovieClips as parameters to detect collision between two things. How could I make it so that one of the parameters is ALL the instances of a certain symbol on the stage.

So if I make 10 instances of an Enemy symbol, how would I make that function check for collision between player and enemies without typing the collision code out 10 times for each enemy instance?

Thanks

This topic has been closed for replies.
Correct answer Ned Murphy

There are a few ways you could approach it.  One way would be to store references to the instances in an array and then have a looping function that goes thru each element of the array one after another.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 11, 2013

There are a few ways you could approach it.  One way would be to store references to the instances in an array and then have a looping function that goes thru each element of the array one after another.