java - TileMap Collision -


How do you make a proper collision with tilemap?

This is my current solution:

  int topTileX = ((tileMap.xOffs - x) - 32 - 1) / tile.IIL_ISEAJ; Int topTileY = ((tileMap.yOffs - y) - 32 - 1) / tile.IIL_ SIZE; Int bottomTileX = ((tileMap.xOffs - x) - 1) / tile.IIL_ SIZE; Int bottomTileY = ((tileMap.yOffs - y) - 1) / tile.IIL_SISAJ; Int leftTileX = ((tileMap.xOffs - x) - 32-1) / tile.IIL_ SIZE; Int leftTileY = ((tileMap.yOffs - y) - 32-1) / tile.value_ SIZE; Int rightTileX = ((tileMap.xOffs - x) -1) / Tile IIL_ SIZE; Int rightTileY = ((tileMap.yOffs - y) -1) / tile.IIL_ SIZE; If (Keyboard.isKeyDown (Keyboard.KEY_W)) {if (! TileMap.getLayer (0) [Math.abs (topTileY + 1)] [Math.abs (topTileX)] isBlocked ()) {tileMap.yOffs ++; }} If (keyboard. Itsdown (keyboard. Kiosis) {if (! TileMap.getLayer (0) [Math.bas (below TYVY-1)] [Math.base (Tilex below)] .Bold ()) {tileMap.yOffs -; }} If (Keyboard.isKeyDown (Keyboard.KEY_D)} {if (! TileMap.getLayer (0) [Math.abs (rightTileY)] [Math.abs (rightTileX-1)]. IsBlocked ()) {tileMap.xOffs -; }} If (Keyboard.isKeyDown (Keyboard.KEY_A)} {if (! TileMap.getLayer (0) [Math.abs (leftTileY)] [Math.abs (leftTileX + 1)] isBlocked ()) {tileMap.xOffs + +; }}  

But the player will get stuck in the corners and some tiles will not work. Please tell me in a proper manner to check conflicts and prevent conflicts that this is not happening.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -