Direct X 8.0 (direct draw) collision

Started by
0 comments, last by magnuski 21 years, 8 months ago
how do you actually read the screen buffer in other to give your character a reference point of origin and when to know that it has collided with another object on the screen conceptually?
Advertisement
Well, there is a lot of solutions for it ... here is mine :

To check 2 sprites intersection (A & B for example) :

1 - Check rectangles interesection (bounding rectangle)
A(Xmin1,Ymin1,Xmax1,Ymax1)
B(Xmin2,Ymin2,Xmax2,Ymax2)
If they interesect, go on step 2, else : no intersection

2 - Do a pixel/pixel check ... but not for the whole sprite size !!
Without a picture it''s a bit hard to explain ... imagine the area of the intersection (at a least a small square), so all you have to do is to compute the coordinates of this area and check the pixels inside ...


__________________________



Bruno Wieckowski
Lead Programmer
Exood4 Studios

This topic is closed to new replies.

Advertisement