Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ball {
- constructor(x, y, r, velocityX, velocityY) {
- this.x = x;
- this.y = y;
- this.r = r;
- this.isColided = false;
- this.velocityX = velocityX;
- this.velocityY = velocityY;
- }
- intersects(other) {
- var changeX = this.x - other.x;
- var changeY = this.y - other.y;
- if (Math.sqrt(Math.pow(changeX, 2) + Math.pow(changeY, 2)) <= this.r + other.r) {
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement