Computer Science Canada help with pool |
Author: | thoughtful [ Sat Oct 11, 2003 1:36 am ] | ||
Post subject: | help with pool | ||
Hello, I am trying to make a pool game for my isp. So far i saw Tony's tutorial. I wrote this code from it. It is supposed to have one ball moving at the start. When the first one hits a second ball, the firs tone stops and the second one starts moving. Now my balls dont move at all. If some one can help me with this, or even show me another way, to make pool, ill be grateful. ====Code Starts====
====Code Ends==== |
Author: | Tony [ Sat Oct 11, 2003 2:44 pm ] | ||||
Post subject: | |||||
well if you set your vector to 10,10 (instead of 5,5) it starts moving. I'm not too sure why though... Ether way... some things to consider changing:
for wall collisions... This would with success stop the ball. When you subtract itself from something, you get 0 It should be
Invert the value, make it go the other way. There's something defenatly wrong with the collision. The other ball just FLIES though the table Another thing to consider... with the velocity of over 10, the ball can jump over another ball... You might have to move all the balls pixel by pixel, and use vecolity to determine friction and delay I'd have to admit, that demo I wrote is far from anything good. It was writen a long time ago... I think Catalyst wrote a pool game in turing, check out submissions section to make sure. |
Author: | Homer_simpson [ Sat Oct 11, 2003 3:17 pm ] |
Post subject: | |
this is one i wrote long time ago... but i got bored and didn't finish it... but u might wanna take a look =/ http://www.compsci.ca/v2/viewtopic.php?t=856&highlight=pool |
Author: | thoughtful [ Sat Oct 11, 2003 7:26 pm ] |
Post subject: | WEll.. |
Thnx both of you, well i actually have made pool, in which the balls intercollide & one can shoot the white ball. I havent yet made it so they can fall in the pockets. Anyways i wanted to know if ne one can tell me an equation to find the real angles,(i.e if the ball hits at a slanted angle the other ball's angle should be different than when it hits at a straight angle) hope someone know how this can be figured out. I saw tony's tutorial on this, also got his message but couldn't quite get it to work from n e angle. Jus wondering is someone already knows how to do this, else ill have to put my empty head to work |
Author: | Tony [ Sat Oct 11, 2003 7:39 pm ] |
Post subject: | |
well the way I figured... you compare change of X and change of Y values between two balls collided. The balls vecolity is split up between X and Y components at same ratio of the difference of X and Y values. |