Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
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() && ballPos.y < playerPos.y+playerPaddle.getHeight() && ballPos.y > playerPos.y-(playerPaddle.getHeight()/2)){
  3.     ballDirection.x *= -1;
  4. }
  5.  
  6. //after
  7. if (playerBox.contains(ballBox)){
  8.     ballDirection.x *= -1;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement