Archived

This topic is now archived and is closed to further replies.

magnuski

Direct X 8.0 (direct draw) collision

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites