Wednesday, February 3, 2010

And Now for something Completely Different

So I've been working on a side-project in pygame for a while now. Probably long enough to constitute more than a side project per se, but whatever. Not gonna explain anything about it, but here's a few things I made it do that made me smile.
  • Implemented my very own Vector class. Not the vector that means "a smarter array", that'd be stupid (python, remember?). No, my Vector class is pretty much the backbone of the nifty-ish things I can make the game do, and best yet it integrates quite well with the tuples that pygame assumes I'm using anyway, so for system calls to drawing functions, for instance, I don't even need to convert my Vectors into tuples (because for all intents and purposes as called by a function, they behave pretty much identically).
  • Finally got bullet motion pretty much ironed out. Bullets spread out in a gaussian distribution, so shotguns are worthwhile at medium range. Collision detection is implemented in a way such that bullets "move" ten pixels at a time (currently enemies are 40x40 rectangles) so as to ensure hitting enemies even when moving at high velocity. Still to do: implement a recoil system where your rapid-fire guns are more accurate when fired in short bursts.
  • It's got explosions in it. Explosions are drawn to any arbitrary size based on the radius of said explosion. To draw an explosion, I draw circles on top of one another of varying color, starting with orange on the rim, passing through yellow in the middle, nearing white at the center. In order to keep from having to re-render each explosion each time it's called, I first check if the explosion is already stored in a list I've made. If so, I just draw the pre-rendered image. If not, I make the image, then draw it. This technique I learned while working on Rouge (which I will do more of eventually).
And for another aside: Mass Effect 2 is completely fantastic. I'll review it once I stop being too excited about it and can analyze it fairly.

No comments:

Post a Comment