Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Having collision problems and [why laws of universe r wrong]
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3, 4  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Axarent




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Axarent




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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Axarent




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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
PaddyLong




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

radius^2 you mean for the circle Razz
Andy




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

uhoh tony, forgetting rade 10 math eh?
Sponsor
Sponsor
Sponsor
sponsor
Martin




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

And rade 9 english, dodge Wink
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Andy




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




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




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




PostPosted: 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
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 4  [ 47 Posts ]
Goto page 1, 2, 3, 4  Next
Jump to:   


Style:  
Search: