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

Username:   Password: 
 RegisterRegister   
 pong - not collision detection but something like it
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Blade




PostPosted: Tue Jun 03, 2003 12:05 pm   Post subject: pong - not collision detection but something like it

ok. i had no clue what to call this but heres the problem:
i have my little bouncie ball runnin around on the screen. and when it hits my paddle it bounces off right? ok. so when the ball is moving it has to bounce off of the top part of my paddle. so i need to set vx to -vx so it will bounce off or else it will run right throught the paddle bouncing through. but the thing is when i do this the ball just bounces around in a circle so it would hit the top, then bounce around in a circle, hit the bottom, bounce back around hit the same spot as before at the top. and keep doing it like that.... is there any other way to make it more random without the ball speeding up that much?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jun 03, 2003 12:38 pm   Post subject: (No subject)

I think I mentioned it before... have rounded edges with circle reflection so that you can actually have some control of where the ball would go
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Blade




PostPosted: Tue Jun 03, 2003 2:26 pm   Post subject: (No subject)

i dont really understand... i can still have control of where the ball goes... its just i want to make it more random..
Tony




PostPosted: Tue Jun 03, 2003 2:36 pm   Post subject: (No subject)

well when it hits your paddle, doesn't it just bounce back up?

vY *= -1

to make it more random, you need to change the vX as well
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Blade




PostPosted: Tue Jun 03, 2003 5:53 pm   Post subject: (No subject)

yeah but thats isnt really the problem... it just bounces around in a circle. it hits the same spots. i need it to be more random
Tony




PostPosted: Tue Jun 03, 2003 6:48 pm   Post subject: (No subject)

thats what I keep on telling you... if you shift the velocity along the X axis as well, it you gradually move that circle...

having rounded edges would allow you to implement same collision physics as in pool.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Blade




PostPosted: Tue Jun 03, 2003 8:59 pm   Post subject: (No subject)

ah ic... so i need a round paddle? because i mean, it does it when it hits the sides too
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 1  [ 7 Posts ]
Jump to:   


Style:  
Search: