Author 
Message 
Axarent

Posted: Fri Jun 06, 2003 6:03 pm Post subject: Having collision problems and [why laws of universe r wrong] 


I'm a newb to programming and was wondering if anyone could give me suggestions on how to do collisions for hitting a target that you've shot at. I've been trying and just can't get it to work. Thx 





Sponsor Sponsor



Tony

Posted: Fri Jun 06, 2003 7:04 pm Post subject: (No subject) 


we got tutorials on rectangle and circle colision detections available... all depends on what kind of target you're trying to hit and with what. 
Tony's programming blog. DWITE  a programming contest. 




Axarent

Posted: Fri Jun 06, 2003 9:46 pm Post subject: (No subject) 


well I was trying a space shooter with a moving enemy picture that I drew in paint and flys across the screen. i'm using draw line to create the shot should I try to use draw oval and box to make the enemy to make it easier?? 





Tony

Posted: Fri Jun 06, 2003 9:58 pm Post subject: (No subject) 


well you could treat the ships as circles (keep the picture though) and use equations y = mx + b and x^2 + y^2 = radius to see if your lazer line intersects the ship or not. 
Tony's programming blog. DWITE  a programming contest. 




Axarent

Posted: Sun Jun 08, 2003 5:47 pm Post subject: (No subject) 


so would I use the coordinates of my laser line for y and x in y=mx +b and the coordinates of the enemy for x and y in x^2 + y^2 = radius and then check if the line intersects the diameter at anytime right?? 





Tony

Posted: Sun Jun 08, 2003 8:57 pm Post subject: (No subject) 


yeah, but as bugz pointed out in another post, I got forumulas mixed up a bit...
for the line, its better to use Ax+By+C=0 I think...
circle is (xa)^2 + (yb)^2 = radius^2 where a/b are x/y of circle's center. 
Tony's programming blog. DWITE  a programming contest. 




PaddyLong

Posted: Sun Jun 08, 2003 10:20 pm Post subject: (No subject) 


radius^2 you mean for the circle 





Andy

Posted: Sun Jun 08, 2003 10:26 pm Post subject: (No subject) 


uhoh tony, forgetting rade 10 math eh? 





Sponsor Sponsor



Martin

Posted: Sun Jun 08, 2003 10:40 pm Post subject: (No subject) 


And rade 9 english, dodge 





Tony

Posted: Sun Jun 08, 2003 10:50 pm Post subject: (No subject) 


huh? it says Quote: = radius ^2
did anyone else read 1984? Great book 
Tony's programming blog. DWITE  a programming contest. 




Andy

Posted: Mon Jun 09, 2003 8:01 am Post subject: (No subject) 


riiite that's y it says last edited by tony... ya its an awsome book, big brother's watching u... 





Grey_Wolf

Posted: Mon Jun 09, 2003 3:48 pm Post subject: (No subject) 


1984 is a great book. What does that have to do with anything. 





PaddyLong

Posted: Mon Jun 09, 2003 4:35 pm Post subject: (No subject) 


1 + 1 is only 2 becuase we've been trained to believe it (or somethign to that effect... haven't read the book for a while) 





Andy

Posted: Mon Jun 09, 2003 5:22 pm Post subject: (No subject) 


hey man, tony owns the site, he can say any thing he wants.. 





Tony

Posted: Mon Jun 09, 2003 6:05 pm Post subject: (No subject) 


it was 2+2=5... and those guys are right... here's the math proof behind it (someone had part of this equation as their signature)
assume x = a
x^2 = ax
x^2  a^2 = ax  a^2
(x+a)(xa) = a(xa)
x+a = a
x + x = x
2x = x
2x + x = x + x
3x = 2x
5x  2x = 2x
5x = 2x + 2x
*divide both sides by x
5 = 2 + 2
So teachnically... the book is telling the truth. 2+2 does equal to 5. 
Tony's programming blog. DWITE  a programming contest. 




