XNA 2D vehicle wall collisions

Posted by mike on Game Development See other posts from Game Development or by mike
Published on 2012-10-31T02:06:26Z Indexed on 2012/10/31 5:22 UTC
Read the original article Hit count: 186

I am attempting to implement collisions for my truck game, where the truck can drive around the world and hit walls surrounding the level and various randomly placed walls within the level. I am able to get direct collisions working correctly. However, it is getting very complicated and tricky very quickly.

I am trying to accommodate various other collisions such as when a truck is against the wall then turns an adjacent direction or when they reverse into a wall. Both of these result in a slight collision as the image of the truck flips around to the direction the player wants to move. All of this has resulted in a whole lot of if statements to check how I should be fixing the collision. This in turn makes the player jump to random locations and "teleport" around corners, etc.

The rest of my game is fine, I am not completely new to game development or C# for that matter. It's just the logic of collisions. Any ideas on how I can approach this?

Image of the collisions I am trying to resolve: http://tinypic.com/r/2qtflvq/6

© Game Development or respective owner

Related posts about XNA

Related posts about collision-detection