Collision detection
Hello world !
I would like to know how to detect 2d colision with pixel level...
Can someone explain me how to do it ??
Well pixel perfect collision detection is fairly simple. In this instance let''s say we have a 32x32 tile, and a 64x64 character. Now because testing each pixel for a collision is extremly slow especialy when done on a large scale you should first do a bounding box test. If my 64x64 character has hit the location of the 32x32 tile, then it''s time for us to check the pixels. Now in this instance both our 32x32 tile & 64x64 tile use RGB 0,0,0 for the transparent color. So now we test each pixel in our 32x32 tile & 64x64 tile until the RGB color isn''t 0,0,0. Once this happens you have a collision.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement