Computer Science Canada

Need some help ... (please reply ASAP)

Author:  poseidon [ Tue Mar 25, 2003 10:07 pm ]
Post subject:  Need some help ... (please reply ASAP)

I'm doing this smiley bouncing program for my comp sci class rite now ...

and I'm trying to get an aspect of it working properly ...

the assignment is as follows:

two smiley faces (a circle w/ two dots as eyes and an arc as a mouth) bounces around the output window...

the bouncing action occurs when the outer boundary of the oval hits any boundary int he output window.

ok, tats the easy part, which i have already completed .... but the thing tats got my mind boggled (as well as my classmates) is tat whenever the smileys hit one another ...

each smiley will rebound in the opposite direction they were originally moving at.

(eg. one smiley is initially moving down in a diagonal slant and after a rebonud w/ the other smiley it moves up w/ the same diagonal slant)

in addition ... whenever the two smileys hit (each other or any boundaries) their face changes from a smile to a frown

I have already completed the prog up to the interaction between the two smileys .... I'm jsut really trying to get the rebound action to wrk ...

I would appreciate any help u guys can offer ...

but plz ... reply soon (b4 wednesday nite), for the assignment is due on thursday


Author:  azndragon [ Tue Mar 25, 2003 10:35 pm ]
Post subject: 

First of all, you will need some good knowledge of physics. Second of all, there is already a tutorial about making a pool game that sounds like the same problem as yours. The tutorial should help you a lot.

Author:  Asok [ Tue Mar 25, 2003 11:27 pm ]
Post subject: 

The tutorial is located here:

Author:  poseidon [ Wed Mar 26, 2003 6:26 pm ]
Post subject:  hey thx

jsut wanted to say, thx for the help ...

tat one simple math distance formula did it all