Public Group

# Help with pong issues

This topic is 4825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do you pause the ball and stop all padle movment ? There is an issue with my paddle colltion detection the ball will some times follow the y axis of the paddle. Any ideas why? Also how do I make the ball so it will spin in the direction of the paddle movment?
 if ((BallX+60 ) >= PaddleX&& (BallX+60) <= (PaddleX+49)   &&(BallY+57) >= PaddleY&&(BallY+57) <= (PaddleY+200) )
{

BallVX = -BallVX;

}
{

BallVX = -BallVX;

}



##### Share on other sites
very messy if statements, you might want to break them up and comment them.

How is ur field layed out, the detection for object in the field or screen?

##### Share on other sites
/////For human paddle//1) ball x and its width, paddles x and  ball x and paddle x and its wdith//2) ball y and its hieght,paddles x and ball y and paddle y and its hieghtif ((BallX+60) >= PaddleX && BallX <= (PaddleX+49)   &&  (BallY+57) >= PaddleY && BallY <= (PaddleY+200))     {          BallVX = -BallVX;//change balls direction          //need to add randome to it and spin } /////For Ai paddle// every thing the same hereif ((BallX+60) >= AIPADX && BallX <= (AIPADX+49)   &&  (BallY+57) >= AIPADY && BallY <= (AIPADY+200))     {          BallVX = -BallVX;          //need to add randome to it and spin           }

each paddle has seprate data and ball data is seprate from each paddle

every thing is detrimned by the scrren coords

Also the ball fallows the paddles y axis only when the ball is coing from the top or bottom and instead of bouncing of the top or bottom of the paddle it goes along the paddle and it is only inside it not in front or behind it

##### Share on other sites
any body have nay idea?

any help will do

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633307
• Total Posts
3011289
• ### Who's Online (See full list)

There are no registered users currently online

×