This content has been marked as final. Show 3 replies
The code you're using is really old...back to Flash 5, I'd guess, which makes this rather more complicated than it need be.
Since you seem to be in AS1, I'll keep it that way. Try using:
xGridNum = Math.round(Math.random() * 7);
yGridNum = Math.round(Math.random() * 7);
var bomb = _root["alienBomb"+alienBombNum];
var alien = _root["alien"+xGridNum+"_"+yGridNum];
bomb._x = alien._x;
bomb._y = alien._y;
The above isn't the best way to do this, but it's simple and not far from what you've referenced. The sevens above assume 8 rows and 8 columns of aliens (numbered alien0_0 to alien7_7).
Hope that helps.
That's great and works perfectly - thank you.
I should have mentioned that I'm using Flash MX 2004.
Much appreciated - I'm going to be posting a couple more questions shortly, on keyboard control and the player ship firing if you feel like helping some more.