//Checks if two objects have collided, returning true if they have or false if they haven't
 //Collision detection is based upon the radius of the objects and the distance between them
 public bool checkCollision(GameObject object2)
 {
     float distance = (float)(Math.Sqrt(Math.Pow((this.x - object2.x), 2) + Math.Pow(this.y - object2.y, 2)));
     if (distance < this.radius + object2.radius) return true;
     return false;
 }
Example #2
0
 public void addNonGravityObject(GameObject o)
 {
     this.nonGravityObjects.Add(o);
 }