Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. if (paddle.collision(ball1)){
  2.  
  3. if (ball1.getCenterY() + ball1.getRadius()<paddle.getTopLeftY()||ball1.getCenterY() - ball1.getRadius()>paddle.getTopLeftY()){
  4. ball1.setDirectionX(ball1.getDirectionX()*-1);
  5. }
  6. else{ball1.setDirectionY(ball1.getDirectionY()*-1);}
  7.  
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement