Day 23: Simpler collision detection, arm redrawn

February 5, 2010 by pekuja · Leave a Comment 

After struggling with the collision detection and response, and after realizing the collision detection was the single most expensive thing my game was doing each frame, I decided to switch to a simpler method. Madgarden had earlier suggested on IRC that I should try a plus-shaped collision shape. One vertical line of pixels, one horizontal line of pixels. This seems to work quite well, especially since I can keep checking pixels until I find a large enough area to fit the player sprite. That means that determining the player’s new location can be done at the same time as detecting whether there’s a collision at all. The only real problem I’ve noticed so far is that I can’t make the player climb steep slopes, because he needs to have ground directly below him, so steeper slopes than 45 degrees just are unclimbable due to the nature of the collision shape.

Another thing I fixed was the mole character’s arm. I had previously made the arm a part of the gun sprite, so that the arm would rotate when you aim. The rotation looked ugly though, especially since I couldn’t use any filtering on it as that would make it not fit in with the pixeled main part of the sprite. The solution was to draw a higher resolution version of the arm and gun, and use that unfiltered. This improved the results a lot, and also made me wonder whether it would be feasible to make higher resolution graphics all around. I think I’ll pass on that for now though. Maybe later.

The game is still lacking some core stuff. Namely, the players don’t take any damage or die, there is no score keeping, and there is just one weapon. That’s probably the order I’m going to start implementing these in. After I have those, the rest is all polish. ;-) I’m hoping to get some sort of a pre-alpha release out this weekend.

About pekuja

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!