Daniel Petersen's Blog

Documenting my struggle to make a videogame, amongst other nonsense

Home Projects

2d Jumper

I was fooling around with Box2D one day, and I came up with an interesting mechanic for flying. It reminded me of the show dragonball Z which I used to watch as a kid, and I thought I should give it a go with making it into a small game. I liked to think of it as a mashup of DBZ and Super Smash Brothers.

Your goal was to knock the other player off of the screen, and you could fire energy balls or melee them in order to do that. Energy attacks would damage them and knock them back a bit, and melee would knock the other guy back based on how damaged he was. In order to melee, you had to fly into the other player — If he flew into you, the player who was traveling faster was the player that won. Flying and charging an energy attack ate up your energy, and energy only started to regenerate after a few miliseconds of not using any energy.

I implemented a simple AI for this. It had a state machine that changed states depending upon the context of what was happening in the world. I was actually pleasantly surprised to see how good the AI was considering that I put relatively little effort put into it.

I should mention that I eventually ditched Box2D for this, because what I wanted to do wasn’t that complicated, and I wanted to see if I could program the physics myself. I also had a (terrible) map editor up and running, too. The videos up top are from an older version where the AI / collision detection on energy weapons weren’t working.

Built with C++ and SFML

Copyright © - Daniel J. Petersen