Example #1
0
        public static void LoadContent(ContentManager content, GameWindow window)
        {
            //kod
            background = new Background(content.Load <Texture2D>("background"), window);

            menu = new Menu((int)State.Menu);
            menu.AddItem(content.Load <Texture2D>("start"), (int)State.Run);
            menu.AddItem(content.Load <Texture2D>("highscore"), (int)State.HighScore);
            menu.AddItem(content.Load <Texture2D>("exit"), (int)State.Quit);

            player = new Player(content.Load <Texture2D>("ship"), 380, 400, 4.5f, 2.5f, content.Load <Texture2D>("bullet"));

            enemies = new List <Enemy>();
            Random    random    = new Random();
            Texture2D tmpSprite = content.Load <Texture2D>("mine");

            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);
                Mine temp = new Mine(tmpSprite, rndX, rndY);
                enemies.Add(temp);
            }
            tmpSprite = content.Load <Texture2D>("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);
                enemies.Add(temp);
            }
            goldCoinSprite = content.Load <Texture2D>("coin");
            printText      = new PrintText(content.Load <SpriteFont>("MyFont"));
        }
Example #2
0
        private static void Reset(GameWindow window, ContentManager content)
        {
            player.Reset(380, 400, 4.5f, 2.5f);

            enemies.Clear();
            Random    random    = new Random();
            Texture2D tmpSprite = content.Load <Texture2D>("mine");

            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);
                Mine temp = new Mine(tmpSprite, rndX, rndY);
                enemies.Add(temp);
            }
            tmpSprite = content.Load <Texture2D>("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);
                enemies.Add(temp);
            }
        }