Tuesday, March 20, 2012

Hit a wall? Go around it!

Moving the map with respect to the player wasn't too extensive a task.

I just wrapped up the collision detection between the player and the surrounding world.  There's a lot of looping and decision making code that was just piling up and piling up until I was swimming to deep in it.  The code was a mess and not working right, and it was a headache to make heads or tails of it, so I scrapped the whole thing.  I wrote out what I needed to do on paper and figured out what loops needed to control the collision detection.  After copying some of the old code, it took me just about 45 minutes to rewrite the organised code.  It's so much cleaner now.

That's what I get for starting from scratch with no plan.

Now with collisions working, I am finding that my map movement is not lined up correctly.  I've fixed it on 200% viewing scale, but 100% is still off.  I'll take a look at the drawing code for the world tonight and fix it up.  I'll also start putting together some walking animation for my "naked" player sprite.  I hope to post a video with the collision detection and sprite animation working correctly.

No comments:

Post a Comment