Mail Archives: djgpp/1999/05/06/06:56:56
> I now have another problem which I need help with: I have the spaceship
>(a 32x32 bitmap object) moving about the playing area (a 200x400 bitmap
>object, with colour 128 being solid land), and I want to know when the
>spaceship has hit the land. The spaceship isn't square -- it can be lots
>of different shapes.
> I have thought of making two 32x32 bitmap objects, and then putting the
>land picture with the spaceship over it in one, and the spaceship with
>the land over it in the other, compare the two, and if they're different
>then the land and spaceship must be overlapping. However, I don't know
>how to easily compare two bitmap objects...
> If you know how to do this, or know of any better/alternative way to
>achieve collision detection, then I'd be grateful for any help!
Doing the comparison the way you mention would be a very slow method. Take a
look at the Allegro add-on page for such things
(http://www.talula.demon.co.uk/allegro/addons.html) look for pixel `perfect
collision detection'.
Michael Stewart
- Raw text -