Comparing Colors works sometimes
Hello everyone, here is the scenario. Making a 2D platformer, I have my standard background image, and a completely black and white version also loaded into memory. The black and white image is almost completely white, with the platforms themselves being completely black (no gradiant). Every cycle, I am comparing the color on my BW background against the color black to determine if I am standing on the ground. This works, until randomnly my avatar falls through the ground. It seems to be random at any given place and I cannot figure out why. Can you tell me what I am doing wrong? Furthermore, is there a better way to handle platforming?
3 unsigned char
r1, g1, b1, r2, g2, b2;
8 if (
9 return 0;
11 return 1;
15//in my update
image, x, tempY + 6)
The color_equiv function was by another user on these forums. Thanks for your help
EDIT: Nevermind, figured it out. The question still stands though whether or not there is a better way to handle this
Why not use tilemaps. Or a list of bounding boxes or maybe a list of polygons?
The only game where I can imagine a bitmap to be truly useful for collision detection is a game like worms.
I figured tilemaps would not be accurate enough. Also, I figured that collision detection against many, large, bounding boxes would be less efficient that comparing a single point. Finally, I figured using bitmaps would allow for rapid map development.
Am I wrong?
Well you could always put bounding boxes in a grid. So you only have to check for boxes close to the entities.
Or, although more difficult, you could use a quadtree to put your boxes in.
Also comparing to a single point is not going to be very accurate, at all.
Thread #608462. Printed from Allegro.cc
I figured using bitmaps would allow for rapid map development
If you have found the right tools to keep the "map" and the "collision map" synchronized, then it's a good development method.