Orpheon
Orpheon

Reputation: 191

Pixel-perfect collision on Allegro 5

I am building a 2d platformer game that might have a good hundred or so rotated sprites (characters, rockets, bullets, etc) that I want to let collide with a wallmask. Currently using Allegro 5, which does not support 1bit bitmaps as would be natural to use for this.

Is it better for me to attempt creating my own bitmap implementation, and do some hack for rotation (like cache rotated sprites), or to use one of https://www.allegro.cc/manual/5/allegro_pixel_format and Allegro's get_pixel()?

And for the collision testing itself, should I use some kind of blit'ing the character masks into the alpha channel of the wallmask to test for a single value or is it better to just

if (wallmask[x][y] && character_mask[x+o_x][y+o_y]) { collide(); }

for all relevant x and y?

Thank you.

Upvotes: 0

Views: 579

Answers (0)

Related Questions