Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  


Yesterday I finished up the animation code for the player sprite. It looks really good(by my standards anyway).

I spent most of that time tracking down an annoying bug with the animation code. When the player was next to a ledge, it would use the jumping animation, even though it was clearly on the ground. It was really hard to track down the problem.

The problem essentially was due to the fact that I treated manually jumping and falling off a ledge as the same action. This made it easier to handle situations where the player fell off ledges. However, I found that the only way to fix this animation bug was to have the program know the difference between jumping and falling.

If that was confusing to understand I apoligize, but it is hard to explain what exactly was the problem. I only understand it because I was the one who actually wrote it.

I should have gotten a screenshot of it before I fixed it, because it looked pretty funny.

Also, I started programming enemies into the game. In the past when I've created multiple enemy types, I would have a single enemy class and a variable inside that class that says what type of enemy it is. Than I would use a switch statement to handle the behavior of each enemy. So something like this:

// Do ninja stuff
// Do pirate stuff

This is fine if I'm writing a game with C. However, I'm writing a game with C++, so I think I should take advantage of polymorphism for this task.

So for instance, instead of the above code, I would now have:

Enemy *bob = new Ninja();
Enemy *bill = new Pirate();


delete bob;
delete bill;

Ofcourse it won't look like that, but that is the general idea of what I'll be doing.

I haven't actually gotten any enemies working yet, but I have my Enemy base class working. Hopefully I'll have some screenshots when I'm done with that.
Sign in to follow this  


Recommended Comments

I can empathize with the animation issues; I dealt with the same kind of beef when I wrote Magma Duel. :) Similar issues arose for me when I tried to unite the jump/fall states, but I ended up taking the same route and having them work individually.

Share this comment

Link to comment
It's kindof a drag too. I thought I was soooo clever when I thought of making jumping and falling the same action. Ofcourse, when I actually added animation that all fell apart[sad]

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!