Timeline for JavaScript - 2D Top-down Tile Collision Detection
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 15, 2013 at 17:12 | comment | added | Mokosha | Until he has a size 128x128 boss sprite. ;) That's why I said "in general" | |
| Apr 15, 2013 at 17:08 | comment | added | UnderscoreZero | @Mokosha Going on his situation alone, there is no need to check more than a few points seeing as how his characters and tiles are very close to the same size. | |
| Apr 15, 2013 at 16:56 | comment | added | Mokosha | This won't work in general. For example, if you have 4x4 tiles and 64x64 characters, there's a very small chance that any of the corners or midpoints of the character will be within a single solitary solid tile. The problem that's being described here is an AABB intersection test. | |
| Apr 15, 2013 at 16:08 | vote | accept | devlsh | ||
| Apr 15, 2013 at 15:42 | comment | added | devlsh | Ah yes - I completely forgot about this method. Thank you for your help! | |
| Apr 15, 2013 at 15:40 | comment | added | UnderscoreZero | I didn't realize this but your character sprite is much taller than your ground tiles, you should be able to get a good effect if you use a 26x26 box at the characters feet for collision detection, that way the top half of the character can overlap tiles (not sure if that's what you are going for). | |
| Apr 15, 2013 at 15:34 | comment | added | devlsh | Thank you for your comment, currently I do check each corner and the problem arose with not having a midpoint. Although; Entity Height and Width are both variables that can always be changed, so can you think of a good way to determine the amount of midpoints to have, and also where they should be? | |
| Apr 15, 2013 at 15:30 | history | answered | UnderscoreZero | CC BY-SA 3.0 |