Thread: Pixel perfect 2D collision detection with Allegro

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    32

    Pixel perfect 2D collision detection with Allegro

    Hi all,
    I'm struggling with implementing pixel perfect 2D collision detection for my simple 2D game. I'm also using Allegro, if that helps.

    I know what the basic algorithm is, but... is there a way for me to use allegro to simplify this?

    Notes:
    I have sprites loaded from bitmaps, but I rotate them according to the way they're facing (360 degrees are possible) I've also created a parallel list of mask bitmaps with black for where there's background and white for where that pixel is part of my character.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You might want to look at some sample source for collision detection. I don't use Allegro, but I know there are several SDL libraries that do this.

    [edit] You might try google, if you haven't already: http://www.google.ca/search?hl=en&q=...etection&meta= [/edit]

    [edit=2] This should probably be in the Game Programming Forum. Nothing you can do about it now, though. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pixel perfect collision / "terrain" destruction
    By cboard_member in forum Game Programming
    Replies: 1
    Last Post: 09-09-2006, 12:54 PM
  2. 2D pixel perfect collision detection
    By Warlax in forum Game Programming
    Replies: 0
    Last Post: 06-22-2006, 07:39 AM
  3. 2D sidescrollers and collision detection
    By funkydude9 in forum Game Programming
    Replies: 16
    Last Post: 03-26-2003, 09:22 PM
  4. bounding box collision detection
    By DavidP in forum Game Programming
    Replies: 7
    Last Post: 07-07-2002, 11:43 PM
  5. Replies: 4
    Last Post: 05-03-2002, 09:40 PM