Wednesday, November 28, 2007

Me vs. Collision Detection - Part 2

For the past week or so, I've been struggling with getting collision detection to work properly in SWORDS.

The algorithm I use works like this:

1. Check map for "solid" tiles.

2. Store the solid tiles' coordinates in a structure array.

3. When there's input, check to see if the player sprite will intersect with any solid tiles.

4. If yes, don't move the sprite. If no, move the sprite.

For you programmers out there that might be able to point out any possible errors in the algorithm, leave a comment or drop me a line on the forums.

No comments: