|
Should be simple, but it's not as simple as I though. I have monsters in an XML list for waves of enemies, and I need to spawn multiple enemies per wave. However, when I do so with my current code, both spawn, but only one will spawn correctly, and he other will not move, nor will it spawn correctly. I think I need to call upon each element in the array, but I don't know how. }
(comments are locked)
|
|
Have you tried to place all the codes you wrote after the for loop, inside the for loop, so that it is done right after instantiating. I would think the way it is done now, first round in the for loop, spawnemob points to a place in the memory then second round the same spawnmob points to a new location in memory then you fetch the component of that object pointed at but the firts one is lost in memory.
(comments are locked)
|

You are right, that was the problem. I fixed it, and I was also not calling the array where needed. If anyone is wondering for the fix:
{ if ( wavesArray ) { if ( spawnedMob == null ) { if ( waveIndex < wavesArray.length ) { var currentWave:WaveInfo = wavesArray[waveIndex];
}