Jump to content
  • Advertisement

Archived

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

magnuski

Direct X 8.0 (direct draw) collision

This topic is 5878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!