Can somebody please explain the colision layers?

BlitzMax Forums/BlitzMax Beginners Area/Can somebody please explain the colision layers?

Traian(Posted 2008) [#1]
Hi

I'm relatively new to BMAX and i'm having a hard time understanding teh colision layers. What are they what do they do?

Can somebody point me to a more complete documentation that explains collision layers or give me here the crash course?


Perturbatio(Posted 2008) [#2]
A simple explanation (as I understand them):

Imagine the collision layers as a large two colour image (black/white) that has the same dimensions as the screen.

When you draw an image to the collision layer it converts all transparent areas to black and all non (or semi) transparent areas to white.

When you do a check for a collision, all bmax does is determine if any portion of the image you are checking overlaps any white area in the collision layer.

*edit*

I'm not sure this is 100% accurate, but no doubt someone will jump at the chance to correct me :)


Philip7(Posted 2008) [#3]
How does this translate to the collisionlayer in multilayer-tilemaps i keep reading about?


tonyg(Posted 2008) [#4]
It doesn't translate at all. They're different things completely.
<edit> Unless you use a Bmax collision layer for your tilemap collision layer of course.

Learning 2D Game Programming: Max 2D Collision Part 1
is a great tutorial on collisions (in 3 parts).


Traian(Posted 2008) [#5]
Thanks!


MGE(Posted 2008) [#6]
You know, I've never used collision layers yet. I've just been using routine based rect or circle based collision checking. I wonder if I'm missing anything as far as speed improvement by not using collision layers?


Traian(Posted 2008) [#7]
Lately i've been abusing collisions and while i can say that the system is very simple to use once you figure out what each function does, it's very slow. Avoid them whenever possible.

Only when you need pixel perfect collisions use the bmax collision system.