Jump to content

  • Log In with Google      Sign In   
  • Create Account

skuzzbag

Member Since 26 Aug 2010
Offline Last Active Dec 27 2012 05:24 PM
-----

Topics I've Started

2D tile map collision detection

26 December 2012 - 10:20 AM

I've got a problem with my tilemap based collision detection. The problem is getting stuck on walls and I was wondering what the method is to tackle this issue.

 

For example moving left/right works ok and also checking for solid tiles above and below. However diagonal movement causes the issue where the player sprite sticks to the wall.

 

Currently if a check is made on a point around the sprite for example -1 pixel and this tile is found to be solid then the player x position is set to be to the right on the solid tile (player.position.x = (tile.X / 16)+ player.width) - so in effect the player just stops moving left.

 

Should you first check for and correct X positioning before moving onto checking and correcting Y positioning? Currently I am checking X/Y then correcting X/Y.

 

Thanks.


PARTNERS