예제 #1
0
        // ==========================================================
        // LoadContent(), laddar in data
        // ==========================================================
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            player      = new Player(Content.Load <Texture2D>("images/player/ship"), 380, 400, 2.5f, 4.5f,
                                     Content.Load <Texture2D>("images/player/bullet"));

            // Skapa fiender
            enemies = new List <Enemy>();
            Random    random    = new Random();
            Texture2D tmpSprite = Content.Load <Texture2D>("images/enemies/mine");

            for (int i = 0; i < 10; i++)
            {
                int  rndX = random.Next(0, Window.ClientBounds.Width - tmpSprite.Width);
                int  rndY = random.Next(0, Window.ClientBounds.Height / 2);
                Mine temp = new Mine(tmpSprite, rndX, rndY);

                // Lägg till i listan
                enemies.Add(temp);
            }

            tmpSprite = Content.Load <Texture2D>("images/enemies/tripod");
            for (int i = 0; i < 5; i++)
            {
                int    rndX = random.Next(0, Window.ClientBounds.Width - tmpSprite.Width);
                int    rndY = random.Next(0, Window.ClientBounds.Height / 2);
                Tripod temp = new Tripod(tmpSprite, rndX, rndY);

                // Lägg till i listan
                enemies.Add(temp);
            }

            printText      = new PrintText(Content.Load <SpriteFont>("Fonts/Arial"));
            goldCoinSprite = Content.Load <Texture2D>("images/powerups/coin");
        }
예제 #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);


            // Skapa fiender
            enemies = new List <Enemy>();
            Random    random    = new Random();
            Texture2D tmpSprite = Content.Load <Texture2D>("images/enemies/mine");
            int       posX      = 0;
            int       posY      = 0;

            for (int i = 0; i < 100; i++)
            {
                //int posX = random.Next(0, Window.ClientBounds.Width - tmpSprite.Width);
                //int posY = random.Next(0, Window.ClientBounds.Height - tmpSprite.Height);
                if (posX < 1350)
                {
                    posX += 150;
                }
                else
                {
                    posX  = 0;
                    posY += 150;
                }

                Mine temp = new Mine(tmpSprite, posX, posY);

                // Lägg till i listan
                enemies.Add(temp);
            }

            tmpSprite = Content.Load <Texture2D>("images/enemies/tripod");
            int posX1 = 75;
            int posY1 = 75;

            for (int i = 0; i < 100; i++)
            {
                if (posX1 < 1350)
                {
                    posX1 += 150;
                }
                else
                {
                    posX1  = 75;
                    posY1 += 150;
                }

                Tripod temp = new Tripod(tmpSprite, posX1, posY1);

                // Lägg till i listan
                enemies.Add(temp);
            }
        }
예제 #3
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);


            // Skapa fiender
            enemies = new List <Enemy>();
            Random    random    = new Random();
            Texture2D tmpSprite = Content.Load <Texture2D>("images/enemies/mine");
            int       posX      = 0;
            int       posY      = 0;

            for (int i = 0; i < 100; i++)
            {
                if (posX < 1350)
                {
                    posX += 150;
                }
                else
                {
                    posX  = 75;
                    posY += 150;
                }
                Mine temp = new Mine(tmpSprite, posX, posY);

                // Lägg till i listan
                enemies.Add(temp);
            }

            tmpSprite = Content.Load <Texture2D>("images/enemies/tripod");
            int posX1 = 75;
            int posY1 = 75;

            for (int i = 0; i < 100; i++)
            {
                if (posX1 < 1350)
                {
                    posX1 += 150;
                }
                else
                {
                    posX1  = 75;
                    posY1 += 150;
                }
                Tripod temp = new Tripod(tmpSprite, posX1, posY1);

                // Lägg till i listan
                enemies.Add(temp);
            }


            goldCoinSprite = Content.Load <Texture2D>("images/powerups/coin");
        }