MC placed multiple times and given same instance name?
Hi everyone, I am pretty new to code in flash.
I am mostly used to use object oriented programming, but in flash I'm doing everything in one frame.
I am making a car game. Kinda GTA style, but very simple. You are a police car, and you chase a theif through a city.
The theif uses ground nodes to know where he can drive, and where he can turn.
basically, below is the stage. I have placed these objects directly onto the stage, and given some of them instance names.:
_________________________________
| O
| O ©
| _______________________
| |
| |
| |
| |
| ^ |
| | |
| X |
The © is a MC named node_switch.
The O's are the two objects of the same MC, which both are named node_stop
The X is the theif (mc), and he is driving upward along the road.
When theif hits node_switch, he will look up,down, left and right if any node_stop is placed.
This is done with hitTestObject. the theif has invisible "beams" in all 4 directions, inside it's MC.
The problem is as following:
When multiple nodes are placed on the stage, the theif only collides with one of them.
As I said, they have the same instance name.
Is there a way to be able to place them directly on the stage, give them all the same instance name, and make a for loop where it goes through all of them and checks collision?
Edit:
Or is it maybe possible to place them directly on the stage, give them instance names such as "node_switch01", "node_switch02", and then check for them all at the same time in a for loop, or in some other way? there will be lots of nodes, so...