dermetfan

isometric collision detection (answer to ArlaeroS)

Oct 25th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. http://www.youtube.com/watch?v=TLZbC9brH1c&lch=email&lc=32wAA8xxHqL2AWwsb5FpJVIHNepz6Vzurg_9X7ZMEHc&feature=em-comment_received
  2. http://www.youtube.com/user/ArlaeroS
  3.  
  4. 1. Not quite, you have to check the base of the player instead of the bounding rectangle of its sprite.
  5. 2. The height of the player doesn't matter, only its width and depth. Since isometric is still 2D, he doesn't have a depth though, so you have to use a separate bounding rectangle. This bounding rectangle should be the bounding of the base of the player, not of the sprite. It doesn't need to be rotated if you convert the points in the isCellBlocked method. MapUtils#toIsometricGridPoint(..) does this, you can use or copy it: http://goo.gl/PZDBNy
  6. 3. I didn't successfully implement this yet, so I can't make a video... When I figured it out, I'll let you know.
  7.  
  8. If you used tile-by-tile movement, it would be way easier. You would just have to check if the target cell is blocked. For that you would need to get the cell the player is currently on (maybe with converting like in 2) and add/subtract 1 on x or y, depending on the direction you're going.
Advertisement
Add Comment
Please, Sign In to add comment