Exemplo n.º 1
0
 private void MoveNos(Nos thenos)
 {
     thenos.Position.Y += mVelocityY;
     if (thenos.Position.Y > graphics.GraphicsDevice.Viewport.Height && thenos.Visible == true)
     {
         thenos.Visible = false;
         thenos.isEated = true;
         existNos       = false;
     }
 }
Exemplo n.º 2
0
        private int CheckNosPosition(Nos thePineapple)
        {
            BoundingBox aPineappleBox = new BoundingBox(new Vector3(thePineapple.Position.X, thePineapple.Position.Y, 0), new Vector3(thePineapple.Position.X + (mNos.Width * .4f), thePineapple.Position.Y + ((mNos.Height - 50) * .4f), 0));
            BoundingBox aCarBox       = new BoundingBox(new Vector3(mCarPosition.X, mCarPosition.Y, 0), new Vector3(mCarPosition.X + (mCar.Width * .2f), mCarPosition.Y + (mCar.Height * .2f), 0));

            if (aPineappleBox.Intersects(aCarBox) == true && thePineapple.isEated == false)
            {
                MoveNos(thePineapple);
                thePineapple.Visible = false;
                thePineapple.isEated = true;
                existNos             = false;
                score += 100;
                mVelocityY++;
                return(1);
            }
            return(0);
        }
Exemplo n.º 3
0
        private void AddPineapple()
        {
            int aRoadPosition = mRandom.Next(1, 5);
            int aPosition     = 130;

            if (aRoadPosition == 2)
            {
                aPosition = 180;
            }
            else if (aRoadPosition == 3)
            {
                aPosition = 350;
            }
            else if (aRoadPosition == 4)
            {
                aPosition = 500;
            }
            bool aAddNewPineapple = true;

            foreach (Nos aPineapple in mNoss)
            {
                if (aPineapple.Visible == false)
                {
                    aAddNewPineapple    = false;
                    aPineapple.Visible  = true;
                    aPineapple.isEated  = false;
                    aPineapple.Position = new Vector2(aPosition, -mNos.Height);
                    break;
                }
            }
            if (aAddNewPineapple == true)
            {
                //Add a Pineapple to the left side of the Road
                Nos aPineapple = new Nos();
                aPineapple.Position = new Vector2(aPosition, -mNos.Height);

                mNoss.Add(aPineapple);
            }
        }