But considering there are going to be lots of missiles, I am curious as to what a good approach is for storing the values for each one (I'm going to be using structs here.) Should I do something like:
- Code: Select all
//define all possible missiles
missile MissileOne
missile MissileTwo
...
And just use the variables as needed (pre allocating the RAM for them, as it where), or is there a more elegant approach? I know Crabator has many crabs (all of whom are the same type of thing, obviously), but it's a bit hard to read through.
Apparently arrays work, too, or should.
- Code: Select all
//Array of missiles
missile missileArray[15];
(somwhere later)
missileArray[5].start_x = 10;
The above seems valid, not any better on memory, but certainly easier to read.