Esempio n. 1
0
 public bool Intersect(Character charater, RegularCoin coin, SpriteBatch spriteBatch)
 {
     Rectangle characterRectangle = new Rectangle(charater.X, charater.Y, 125, 125);
     Rectangle coinRectangle = new Rectangle(coin.X, coin.Y, 80, 80);
     if (!coin.isCollected)
     {
         if (coinRectangle.Intersects(characterRectangle))
         {
             coin.isCollected = true;
         }
     }
     if (!coin.isCollected)
     {
         return true;
     }
     return false;
 }
        public bool Intersect(Character charater, RegularCoin coin, SpriteBatch spriteBatch)
        {
            Rectangle characterRectangle = new Rectangle(charater.X, charater.Y, 125, 125);
            Rectangle coinRectangle      = new Rectangle(coin.X, coin.Y, 80, 80);

            if (!coin.isCollected)
            {
                if (coinRectangle.Intersects(characterRectangle))
                {
                    coin.isCollected = true;
                }
            }
            if (!coin.isCollected)
            {
                return(true);
            }
            return(false);
        }