C++ and allegro depth

Started by
0 comments, last by Gage64 16 years, 9 months ago
I've sucessfully created a nice maze game with many objects. But when the character walks over a piece of background or annother object, it flickers madly. A bullet or a coin over a piece of background is also flickering. Is there a way I can give each object it's own depth into the screen, so the objects of deeper depth will yield to the objects of lesser depth? Oh, and this is a 2d game using allegro and c++. Help greatly appreciated!
Advertisement
Quote:
Original post by yurian
Is there a way I can give each object it's own depth into the screen, so the objects of deeper depth will yield to the objects of lesser depth?


You can assign a depth value to each sprite, but that would only determine their drawing order for your program, i.e., allegro can't use this information internally (I think).

But if you are always drawing the background first and then the objects, there shouldn't be a problem. If you're drawing them in alternating order, that will cause flickering.

Also, are you using double buffering?

This topic is closed to new replies.

Advertisement