Hi guys, sorry if this is a redundant topic (as it certainly seems to be) but I’ve done a lot of reading and still can’t get this to work.
I’m trying to make a simple arcade style game where a ship fires a “laser” and it hits other ships. Both the laser and the ships are being created dynamically with duplicateMC, so I can’t figure out how to hitTest if I don’t have the name of each instance.
Each time a ship is created I have it adding a new count/depth, for instance it starts as ship, then ship1, ship2, ship3, etc. Same with the lasers that I’m shooting, laser1, laser2, laser3, etc.
So since the normal syntax is:
if (_root.laser, hitTest(_root.ship)) or vice versa
How can I get it to continually check with each new instance. I’ve read the tutorial and it suggests putting all the instance names into an array, but for whatever reason the FLA file for that won’t open in my program and I can’t see how to do it.
I assume you would put them into the array as [ship1, ship2, ship3) etc. but what if the game has been running for awhile and it gets to something like ship56 or even ship156? Would I in theory have to mane an array with 100 names in it? Seems like that would be a big waste of time, so there must be some way to do it I’m not seeing.
Any help would be greatly appreciated. I’ve been stumbling on this for awhile now and can finally move on once I get this working.