Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spelare = new Bräda(Content.Load<Texture2D>("player"), new Vector2(450, 500), new Rectangle(400, 500, 100, 15));
            boll = new Boll(Content.Load<Texture2D>("ball"), new Vector2(300, 150), new Rectangle(300,100,20,17));
            poäng = new Poäng(new Vector2(490, 280), Content.Load<SpriteFont>("text"));
            //Placerar ut klossarna i rätt möster
            for (int j = 0; j < 4; j++)
            {
                int klossY = j * 30;
                for (int i = 0; i < 10; i++)
                {
                    int klossX = i * 100;
                    klosslista.Add(new Kloss(Content.Load<Texture2D>("unnamed"), new Vector2(klossX, klossY), new Rectangle(klossX, klossY, 100, 30), new Rectangle(klossX, klossY, 3, 30), new Rectangle(klossX + 3, klossY + 27, 94, 3), new Rectangle(klossX + 97, klossY, 3, 30), new Rectangle(klossX + 3, klossY, 94, 3), Content.Load<SoundEffect>("270343__littlerobotsoundfactory__shoot-01")));
                }
            }

            // TODO: use this.Content to load your game content here 
        }
Beispiel #2
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     spelare     = new Bräda(Content.Load <Texture2D>("player"), new Vector2(300, 500), new Rectangle(300, 500, 100, 15));
     boll        = new Boll(Content.Load <Texture2D>("ball"), new Vector2(300, 100), new Rectangle(300, 100, 20, 17));
     for (int i = 0; i < 10; i++)
     {
         int y = 0;
         if (i % 2 == 0)
         {
             y = 0;
         }
         else
         {
             y = 30;
         }
         int x = i * 100;
         klosslista.Add(new Kloss(Content.Load <Texture2D>("unnamed"), new Vector2(x, y), new Rectangle(x, y, 100, 30)));
         ljud = Content.Load <SoundEffect>("270343__littlerobotsoundfactory__shoot-01");
     }
     // TODO: use this.Content to load your game content here
 }