by refractor » Feb 11, 2002 @ 11:05am
Hello.
A general approach is to have a collision map that's similar to the main map. Then, you have a set of collision "tiles" the same size as your graphics tiles (these could be made up of 4, 8, 16, 32, blocks, *however many you need*):
A full tile
a /| tile
a |\ tile
a half-height tile
...
etc
Store them as triangles or boxes in an array. Then you can look up the entry in the collision data and check a point at the character's feet/head against the single box/triangle, which is very simple.
The collision map tends to be *much* more sparse than the main tile map, so you (c)/(s)hould use RLE compression on it to save space.
Another alternative, is to ignore the way the graphics are laid out in tiles and have a polygonal/circle - based collision system, where the characters walk on circles, triangles, boxes, etc of arbitrary size.
(P.s. I really wouldn't have the character only moving from block to block, that *really* sucks game-play wise).
Cheers,
Refractor.