I have a player movieclip and six obstacle movieclips with instance names “obs1”, “obs2”, up to “obs6”. If the player hits any of the obstacles, the variable dead is set to true. The code I have at the moment is:
if (hitTest(_root.obs1)||hitTest(_root.obs2)||hitTest(_root.obs3)||hitTest(_root.obs4)||hitTest(_root.obs5)||hitTest(_root.obs6)) {
dead = true
}
Since that if statement looks pretty ugly as it is, I wanted to know whether it was possible to reference all movieclips with the instance name “obs” followed by a number. I believe it involves square brackets, something like:
hitTest(_root.obs*)
Can anyone give me some pointers?
(I’m using Flash CS3)