Skip to main content
GameDev.net gamedev.net
🔒 Locked

Collision

Started by dta1 Jan 7, 2003 at 9:41 AM 0 replies 400+ views
Original Post
dta1
dta1
If you have an irregular Area. For exampel these points (x, y): 1, 2 5, 6 3, 4 and back to 1, 2 again. Which would make a sort of triangle. If you want to se if another point (x, y) is within this Area, how would you do?
Erase, rewind and improve
athos_musketeer
athos_musketeer
you have two choices..

1) break your mind trying to do it with plain code and lot of math.. like dividing the triangle in little rectangules..

or 2) use some sort of getpixel function to know the color of the triangle.. an example: in the back (a surface that the player can never see) blit an exact triangle with a color say: 0,0,255.. use a getpiel function.. if you get that color you''re touching the triangle..

hope that helps

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.