示例#1
0
 public void CollisionDetectionZomFollow(ZombieFollow zomFollow, int viewportWidth, int viewportHeight, Rectangle bulletRectangle)
 {
     if (bulletRectangle.Intersects(zomFollow.zomFollowRectangle) && bulletAlive == true)
     {
         zomFollow.zomFollowHit = true;
         zomFollow.Respawn(random, viewportWidth, viewportHeight);
         bulletAlive = false;
         //Score increases when collision between zombies and bullet occurs
         score = score + 1;
     }
 }
示例#2
0
        //Calculates player collision with the zombies calling its respawn method
        public void CollsionDetectionZomFollow(ZombieFollow zomFollow, int viewportWidth, int viewportHeight, Bullet bullet)
        {
            Rectangle playerRectangle =
                new Rectangle((int)playerPosition.X, (int)playerPosition.Y,
                              mSpriteTexture.Width, mSpriteTexture.Height);



            if (playerRectangle.Intersects(zomFollow.zomFollowRectangle) && zomFollow.zomFollowHit == false)
            {
                zomFollow.zomFollowHit = true;

                zomFollow.Respawn(random, viewportWidth, viewportHeight);

                playerAlive = false;
                Respawn(viewportWidth, viewportHeight);
                playerHit    = true;
                bullet.score = 0;
            }
        }