So the world ended yesterday. I feel pretty alright. No columns of lava falling from the heavens. No piles of clothes on the streets. I must say, I’m disappointed.
At any rate, now that fears of impending doom have passed I’ve returned from cowering in my basement (I don’t have a basement) to work on the Tower Defence again. Also, I’ve chosen the name Polarity for now. Anyone with a better name should tell me. Now. Please?
I spent some time today optimizing wave-spawning code. I wonder if that’s the kind of phrase that an ubergeek would use to pick up girls. Or guys. I’m not saying ubergeeks have to be guys. Girls have the potential to be as weird as guys are 😀
I’m feeling somewhat lazy at the moment, so I’ll just give a short summary of what exactly I did. Basically, previously I had about 7 variables that I would put into a timeline at 30 second intervals and change them from there. It worked, but it was also really frustrating when I had to go back into the code and tweak difficulty levels, since the code was all over the place. I transferred all those individual variables and values into a single 2D array, from which I can control the values with relative ease. For example, the code for the first wave is:
//wave state, enemy count, enemy type //1 global.wave[0,0]=0 global.wave[0,1]=1 global.wave[0,2]=obj_ebasic
In this instance, the first digit in the array applies to the wave it’s for. The second part of the array is pretty self-evident: it controls the important values for each wave, such as what enemy is being spawned, how many, and what element (state) they are.
I must say, this is the first time I’ve found an actual use for arrays, and I’m proud to have mastered the concept so quickly. Yay me.
More on Polarity soon. Also, I definitely did not name the game such so that I could get hits from people mistyping Portal. -Coughs-