Take this small map for example (made in the map maker! woo!)
This map is tiny (10x10 tiles) and yet there are 7 objects in this scene that will need to be checked for collisions:
The tree
The tree stump
The archway
The building
Three separate rock objects moved close together to give the impression of a rock cluster
The idea behind the collision map is to allow a single check to be performed for collisions rather than one per object. To do this I'll need something that looks like this:
Black regions indicate solid areas while white regions indicate passable areas. As the game runs I can check the player position and the direction they are moving and then check to see if they will end up in a black region. One check that encompasses all objects on the map. Handy! Combine the collision checking with the graphics side of things and no longer are we restricted to checking "collision bounds" (rectangles). We can have any shape we want.
I'll have to add this functionality into the map component, so give me a few days to get it sorted =)
Top of the arch has areas of extra white that shouldn't be there. Is it just to do with the seperate image of the arch? Though, nice arch.
ReplyDeleteDo the tree trunks/stump need to be so precise. i'm sure a square would do. As it wouldn't make a lot of difference. unless you had to climb up it
ReplyDeleteit's just where I've done a shoddy job of editing the background of the tilesets, can change em on the fly tho ;)
ReplyDeleteAnd yeh the tree stumps could just be a square, but it was just an example of not needing to stick a big sqaure around everything which is what most people tend to do