I know there's a term for this - not sure what it is. Anyway, I have a 2d tile engine for a game. In the tile data, there is a single number for the collision data. Each quadrant of the tile has it's own collision detection, so all the flags are represented as one number.
Maybe it would be easier to understand if I pasted my code:
This works fine, does what I need. It just seems sloppy to me. The collideTL BL etc stands for top right, bottom left, etc. Is there a cleaner way to do this?Code:
//converts the hex value into an int
//if collision is 0 then it doesn't collide with anything