I've been working on a side-scroller (a game like Serious Sam: Double D or Sonic) and I've made quite an extensive engine (C++/DirectX) so far. I have everything from particles and audio implementation to multiple layers and entity collision detection. However I've been stuck on tilemap collision detection for around a week now.
How should I go about detecting collision between the player and a tile? I've probably spend close to 100 hours trying to solve this thing.
Basically what I did was checking if the next pixel is included in TileMap[y][x]; or not, and if it is, then the character shouldn't move. The problem is that the collision between sides is also detected along with the collision from top/bottom, and then the character gets randomly teleported to random positions.
Another thing is that I'd like to do a collision not only between the character and the tiles but also for the pixels IN the tiles, so I could use something more sophisticated than a plain land. However I think that first I should figure out how the main character-tile collision works.
P.S. Ask any questions if you didn't get what I wanted to say - I'm not a native speaker.
P.P.S. Amazing-looking board, I love the header!
2D tile collision detection
Started by DevDude, Dec 05 2011 01:39 AM
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











