My worries of not finishing were exaggerated, it seems. Barring disasters tomorrow, I think I should be able to have a playable and possibly even fun game at the end of the contest.
I’ve made a solid BigMoth class, which implements the behavior for moving towards a target and changing color. One thing I’m really happy with is the way the moth flutters around. I used the trigonometric cos and sin functions to add some nice variation in position, which makes it take a more meandering path towards its target instead of going straight for it.
Then I refactored out a lot of that behavior into a new Moth parent class, which BigMoth inherits from. Next I’ll be adding a LilMoth class, which defines the behavior for the smaller moths that are attracted or repelled by the light. Naturally, it also inherits from the Moth class. Horray for keeping DRY!
I also had an idea for making the gameplay more interesting. Instead of having one color of little moths that fly around and follow you, I’m going to have two – the orange and blue ones, using the same artwork (but made smaller) as the big moth. The orange moths will follow you while you’re orange, and ignore you while you’re blue (not bright enough!); the blue moths will follow you while you’re blue, but fly away when you’re orange (too bright!).
I’m also going to have the concept of light sources other than your character that attract the moths. These will be “focal points” around which nearby moths will fly. If they’re following you but get too close to the other light sources, they’ll stop following you and you’ll have to go back and get them later. Probably there will be 2 or 3 other light sources around as obstacles, plus the goal light which you have to make all the moths fly to.
Maybe if I have time (translation: “I won’t have time to do this, but…”) I’ll add fireflies that float around and change between orange and blue lights, to add another obstacle to the game. They’d float by and attract the moths of that color, making your job a bit trickier. But, yeah, I won’t have time for that this contest.