Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. //before
  2. if (ballPos.x > playerPos.x+playerPaddle.getWidth()/2 && ballPos.x < playerPos.x+playerPaddle.getWidth()
  3.         && ballPos.y < playerPos.y+playerPaddle.getHeight() && ballPos.y > playerPos.y-(playerPaddle.getHeight()/2)){
  4.     ballDirection.x *= -1;
  5. }
  6.  
  7. //after
  8. if (playerBox.contains(ballBox)){
  9.     ballDirection.x *= -1;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement