I managed to get a few hours of free time this afternoon, so I jumped right into the project with full enthusiasm.
Poe and I’ve been discussing various enemies we might want to include in the final game (this stuff here just being a test bed) and one idea was some kind of turtle enemy. So she tried out her pixel art skills for the first time. I quickly threw together the code to make the enemies use the proper frame depending on the direction of travel. I like the way the old ghosts look, but it’s nice seeing something a little more complex now.
I realized that most Zelda games don’t have the enemies flash on and off after they die – instead, they sort of just explode into nothingness. With a little bit of work I got this working. Killing the enemies feels more “rewarding” somehow now. I still need to come up with a good sound effect for it, I really liked the sound effect Zelda 1 used, but I just can’t seem to get anything else like it.
At this point I wasn’t sure what part of the system to work on next – there’s still so, so much to implement. My lack of discipline got the better of me so I went for the lower hanging fruit – having enemies drop items after they die.
I started out by creating a new general GameObject class that I can use to create other types of objects and items down the road. Then I made a Coin class that inherits from it and did a bunch of stuff. This is actually where I wound up spending most of my time – the hit detection was really wonky when it shouldn’t have been, then I realized that the Rectangle class isn’t (x, y, end x, end y) but rather (x, y, width, height). Duh, I’m dumb. In fact, that was the exact same thing I did here. Learn, me!
It was also very easy to make the coins flash as they’re about to disappear – I’m still amazed at how this whole design style lets the code almost write itself!
At this point I didn’t have much time left, so I wondered what I could do to piggyback off of the coin stuff. Showing the number of coins you got seemed like a logical step, but instead I was like, “You know, I’ve always wondered how they implement the achievement systems in modern games, I think I’ll give that a try now.”
It turns out it’s extremely simple, so I added a basic achievement system to the program. The achievements I made are:
- You’re Rich – get 10 coins or more
- You’re a Mass Murderer – kill 20 enemies or more
- Multi-Enemy Killer – kill two or more enemies in one attack
The first two are pretty simple to imagine and set up, but I was amazed at how easy the third actually turned out to be to implement. Again, it’s almost like this stuff writes itself. Back in my old game programming days it would’ve been one of those things I’d never be able to do – or, if I tried, it’d be buggy and poopy.
Anyway, two things of note about my achievement system experiment. One, it’s clear that the way the achievement message is displayed is a major concern. The message right now doesn’t use the same pixel scale as the rest of the graphics – this sort of kills the look in a way, but maybe that’s just the perfectionist in me. I gotta say, using that sliding equation to make the box come in and out looks nice and slick, though 😛 The location of the box is also an issue that will need to be addressed at some point.
And two, it’s clear now that an achievement system like this needs to utilize some sort of queue, that way if you get two or more achievements at once they don’t fire at the same time or one fires while the others don’t but then can never be fired after. But the queue will need to have some sort of delay, so I’ll probably give the achievement class some sort of timer or flag to serve as a signal to the queue.
Also, the temporary achievement tune is from Breath of Fire 1 😛
This is a ton of fun to work on, but I can’t lose sight of the direction the project needs to go. I don’t want feature creep to set in. Also, as I add more and more things, it becomes more obvious how a lot of stuff should be reorganized and simplified into a couple simple classes rather than what I have going now. And at some point I really gotta implement actual animation. But for now I will play this game and kill lots of turtles!