Im searching the equation of bouncing in the game pong and if possible a example of it in c++ or vb
Kevin
Kevin,
Please visit this other recent thread on the subject of Pong collisions:
www.gamedev.net/community/forums/topic.asp?topic_id=102460
Perhaps it will have the answer you are looking for, .
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Please visit this other recent thread on the subject of Pong collisions:
www.gamedev.net/community/forums/topic.asp?topic_id=102460
Perhaps it will have the answer you are looking for, .
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
if(ball.x>=SCREEN_WIDTH)
{
ball.dx =-ball.dx; // dx is the ball''s direction on the x axis
}
//bla...
if(ball hits paddle)
{
if(KEYDOWN(VK_DOWN)) // add downward spin
{
ball.dx+= ball.spin; // you don''t have to change ball direction, it was changed above ^
}
}
//bla, do this for the other directions, etc
Hope that helped
- Jesse Barksdale
{
ball.dx =-ball.dx; // dx is the ball''s direction on the x axis
}
//bla...
if(ball hits paddle)
{
if(KEYDOWN(VK_DOWN)) // add downward spin
{
ball.dx+= ball.spin; // you don''t have to change ball direction, it was changed above ^
}
}
//bla, do this for the other directions, etc
Hope that helped
- Jesse Barksdale
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement