So here is the deal. I've been working on and off on my little platformer and im at the point for collision detection with the map. I have a method that generates a polygon on every tile and checks if the player hits it it's all fine there. But the problem is that when ever a player touches a wall in front of him the D key wich moves him to the front gets disabled so he can't walk any further that way. this method works great for preventing him to walk into walls but i also want him to be able to jump on the walls and there is the problem. So he falls on the tile(polygon) the game senses that and applies the same method for the d key thus preventing the character to walk left or right because the game thinks it is hitting the tile in the front but i is hitting from above (i'm sorry a little vague i'm not good at english). Long story short the games handles collision from the top the same as collisions from front or back because i don't have an idea how to make a method that would make it able to recognize collisions from the top or side. i hope you guys can help if further explantion is needed please ask. Thank you!
This is my code i don't have directly acces to it but it is along the lines of this
if(PlayerPolygon.interesects(TiledPolygon) && dKey==1) {
moveX = 0;
}
if(dKey==1) {
player.x +=moveX
}