Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Having collision problems and [why laws of universe r wrong]
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

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

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

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

Tony

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

huh? it says
Quote:

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.

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)(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.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 4  [ 47 Posts ]
Goto page 1, 2, 3, 4  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: