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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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. |
|
|
|
![](images/spacer.gif) |
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?? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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. |
|
|
|
![](images/spacer.gif) |
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?? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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 (x-a)^2 + (y-b)^2 = radius^2 where a/b are x/y of circle's center. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
PaddyLong
|
Posted: Sun Jun 08, 2003 10:20 pm Post subject: (No subject) |
|
|
radius^2 you mean for the circle ![Razz Razz](http://compsci.ca/v3/images/smiles/icon_razz.gif) |
|
|
|
|
![](images/spacer.gif) |
Andy
|
Posted: Sun Jun 08, 2003 10:26 pm Post subject: (No subject) |
|
|
uhoh tony, forgetting rade 10 math eh? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Sun Jun 08, 2003 10:40 pm Post subject: (No subject) |
|
|
And rade 9 english, dodge ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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 ![Twisted Evil Twisted Evil](http://compsci.ca/v3/images/smiles/icon_twisted.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
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... |
|
|
|
|
![](images/spacer.gif) |
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. |
|
|
|
|
![](images/spacer.gif) |
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) |
|
|
|
|
![](images/spacer.gif) |
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.. ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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)(x-a) = a(x-a)
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. |
|
|
|
![](images/spacer.gif) |
|