예제 #1
0
        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();
            }
        }
예제 #2
0
        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--;
            //}
        }
예제 #4
0
 public override void Update(GameTime gameTime)
 {
     CollidedObjects.Clear();
     base.Update(gameTime);
 }