Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rabbel

Pages: [1]
1
Hi everybody, first time poster here. I am trying to make a pong type game and I am having trouble with getting the ball that i have bouncing around to collide with the paddle correctly. I have seen a few methods online that I must not be implementing right, the ball with either go through the paddle and bounce back a little later, strange movement etc. If anyone can look at my code and give some suggestions that would be great. Just the snippet of the if statement, xMovement is a float var.

 if(ballSprite.GetPosition().x + ballSprite.GetScale().x + ballSprite.GetPosition().y + ballSprite.GetScale().y <= bluePaddleSprite.GetPosition().x + bluePaddleSprite.GetScale().x + bluePaddleSprite.GetPosition().y + bluePaddleSprite.GetScale().y)
                 {
                         xMovement = -xMovement;
                       
                 }

Pages: [1]
anything