Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            foregroundTexture = game1.Content.Load <Texture2D>("Foreground800x600");
            backgroundTexture = game1.Content.Load <Texture2D>("Background800x600");

            pinBall = new PinBall(this, new Vector2(743, 535));
            game1.Components.Add(pinBall);

            // Initialize bumpers


            // Initialize points
            points.Add(new Points(this, new Vector2(200.0f, 300.0f), 40, 20, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            points.Add(new Points(this, new Vector2(350.0f, 325.0f), 50, 30, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            points.Add(new Points(this, new Vector2(500.0f, 300.0f), 40, 30, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            numPoints     = points.Count();
            numDrawPoints = points.Count();
            for (int i = 0; i < numPoints; i++)
            {
                points[i].Initialize();
            }

            textFont = game1.Content.Load <SpriteFont>(@"Tahoma");
            score    = 0;
            turns    = 5;

            // Initialize the flippers
            leftFlipper = new LeftFlipper(this, new Vector2[] { new Vector2(200.0f, 500.0f), new Vector2(312.0f, 515.0f), new Vector2(200.0f, 530.0f),
                                                                new Vector2(192.0f, 515.0f) }, new Vector2(200.0f, 515.0f), new Vector2(9, 15), "LeftFlipper120x30");
            game1.Components.Add(leftFlipper);

            rightFlipper = new RightFlipper(this, new Vector2[] { new Vector2(500.0f, 500.0f), new Vector2(388.0f, 515.0f), new Vector2(500.0f, 530.0f),
                                                                  new Vector2(508.0f, 515.0f) }, new Vector2(500.0f, 515.0f), new Vector2(111, 15), "RightFlipper120x30");
            game1.Components.Add(rightFlipper);


            base.Initialize();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            foregroundTexture = game1.Content.Load<Texture2D>("Foreground800x600");
            backgroundTexture = game1.Content.Load<Texture2D>("Background800x600");

            pinBall = new PinBall(this, new Vector2(743, 535));
            game1.Components.Add(pinBall);

            // Initialize bumpers

            // Initialize points
            points.Add(new Points(this, new Vector2(200.0f, 300.0f), 40, 20, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            points.Add(new Points(this, new Vector2(350.0f, 325.0f), 50, 30, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            points.Add(new Points(this, new Vector2(500.0f, 300.0f), 40, 30, new string[] { "Circle110Blue", "Circle110BlueGrad", "Circle110BlueGrad" }));
            numPoints = points.Count();
            numDrawPoints = points.Count();
            for (int i = 0; i < numPoints; i++)
                points[i].Initialize();

            textFont = game1.Content.Load<SpriteFont>(@"Tahoma");
            score = 0;
            turns = 5;

            // Initialize the flippers
            leftFlipper = new LeftFlipper(this, new Vector2[] { new Vector2(200.0f, 500.0f), new Vector2(312.0f, 515.0f), new Vector2(200.0f, 530.0f),
                                          new Vector2(192.0f, 515.0f) }, new Vector2(200.0f, 515.0f), new Vector2(9, 15), "LeftFlipper120x30");
            game1.Components.Add(leftFlipper);

            rightFlipper = new RightFlipper(this, new Vector2[] { new Vector2(500.0f, 500.0f), new Vector2(388.0f, 515.0f), new Vector2(500.0f, 530.0f),
                                            new Vector2(508.0f, 515.0f) }, new Vector2(500.0f, 515.0f), new Vector2(111, 15), "RightFlipper120x30");
            game1.Components.Add(rightFlipper);

            base.Initialize();
        }