🔒 Locked
Pixel Perfect Collision
Advertisement
Original Post
I am trying to do collision with some stick figures (sad graphics, but least I can make them myself), and the only way I can think of is to use pixel perfect collision. I have no idea how to use this, and I have searched for tutorials on this site, most of them did not really cover it enough and I did not understand them enough to be able to implement them in my game. So can anyone help me and link me a tutorial or even suggest a better method of collision? Edit: I am using c++ with SDL in 2d [Edited by - Salvinger on July 31, 2005 9:20:11 PM]
I am assuming this is 2D. If they are truely stick figures, why not just use line collisions for each piece of the body? If you use bullets, it could be a simple ray/line collision (ad ray/circle collision for the head). Seems to be the easiest way and it should be too computationally expenise. Just do a box test for the whole stick figure before looping through all the lines. An added benefit is you know exactly which part the bullet (or whatever) hit and you can add some nice blood effects...
well in your bitmaps for the figures draw a box around the figure in a color that wont be drawn on screen when you blit. then to test collision you get the coordinates of the box and compare to the other bounding box that may have collided with it. if they touch or overlap then a collison has occured.
that article is interesting indeed but I was unable to find any implementation exaples and have no idea where to start and how to code such technique.
since i'm intrested in pixel perfect collision as well can someone please point some pleace or give an exaple how to do it? my best guess is that i need to use BitBlt function with some compare argument.
since i'm intrested in pixel perfect collision as well can someone please point some pleace or give an exaple how to do it? my best guess is that i need to use BitBlt function with some compare argument.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement