public void CollisionHandling(GameObject sender, CollisionEventArgs e) { if (CollidedObjects.Contains(sender)) { return; } else { CollidedObjects.Add(sender); } // If collision occured with a player bullet... if (e.collisionLayer == 2) { sender.Destroy(); // Flash the thing here. Health--; CheckForDeath(); } else if (e.collisionLayer == 3) { Health -= 2; CheckForDeath(); } }
public void CollisionHandling(GameObject sender, CollisionEventArgs e) { if (CollidedObjects.Contains(sender)) { return; } else { CollidedObjects.Add(sender); } // If collision occured with a player bullet... if (e.collisionLayer == 2) { sender.Destroy(); // Flash the thing here. if (Vulnerable) { // Flash the thing here. Health--; } } // Collided with player; kill! if (e.collisionLayer == 3) { PlayerShip thisShip = (PlayerShip)e.otherObject; thisShip.ObjectCollidedWith(this, new CollisionEventArgs(this, 1)); } }
public void CollisionHandling(GameObject sender, CollisionEventArgs e) { if (CollidedObjects.Contains(sender)) { return; } else { CollidedObjects.Add(sender); } // If collision occured with a player bullet... //if (e.collisionLayer == 2) //{ //sender.Destroy(); // Flash the thing here. //Health--; //} }
public override void Update(GameTime gameTime) { CollidedObjects.Clear(); base.Update(gameTime); }