Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class ball {
  2. constructor(x, y, r, velocityX, velocityY) {
  3. this.x = x;
  4. this.y = y;
  5. this.r = r;
  6. this.isColided = false;
  7. this.velocityX = velocityX;
  8. this.velocityY = velocityY;
  9. }
  10. intersects(other) {
  11. var changeX = this.x - other.x;
  12. var changeY = this.y - other.y;
  13. if (Math.sqrt(Math.pow(changeX, 2) + Math.pow(changeY, 2)) <= this.r + other.r) {
  14. return true;
  15. }
  16. return false;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement