NextFreePosition() modification

Hello there,

I have finished this section, and what I’d like most to change would be to make it so that the formation finishes building even though some of the spaceships has been destroyed already. What I mean is that I am looking for modification for NextFreePosition() function which would remember which position it has already returned. Any tips? Thank you for all your help!

You can make an array and set every field to 0 at start. When spawning fist check if the field for the corresponding position is 0 and if it is spawn an enemy and set the field to 1. Reset the entire array in AllMembersDead() method.

1 Like