Ejemplo n.º 1
0
        public static void LoadContent(ContentManager content, GameWindow window)
        {
            background = new Background(content.Load <Texture2D>("sprites/background"), window);
            menu       = new Menu((int)State.Menu);
            //menu.AddItem(content.Load<Texture2D>("menu/start"),(int)State.Run);
            //menu.AddItem(content.Load<Texture2D>("menu/highscore"), (int)State.Highscore);
            //menu.AddItem(content.Load<Texture2D>("menu/exit"), (int)State.Quit);


            menuSprite = content.Load <Texture2D>("zamypic");
            menuPos.X  = window.ClientBounds.Width / 2 - menuSprite.Width / 2;
            menuPos.Y  = window.ClientBounds.Height / 2 - menuSprite.Height / 2;
            player     = new Player(content.Load <Texture2D>("hamburger"), 380, 400, 4.5f, 6.5f, content.Load <Texture2D>("Laxbullet"));

            enemies = new List <Enemies>();
            Random random = new Random();

            //amount of enemies
            for (int i = 0; i < 10; i++)
            {
                Texture2D tmpSprite = content.Load <Texture2D>("LaxMineEnemy");
                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);
            }
            for (int i = 0; i < 15; i++)
            {
                Texture2D tmpSprite = content.Load <Texture2D>("Laxtripod");
                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);
            }

            printText      = new PrintText(content.Load <SpriteFont>("Spritefont"));
            goldCoinSprite = content.Load <Texture2D>("coin");
        }
Ejemplo n.º 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()
        {
            printText = new PrintText(Content.Load <SpriteFont>("myFont"));
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            player = new Player(Content.Load <Texture2D>("Sprites/ship"), 380, 400, 2.5f, 4.5f);

            // skapa fiender
            enemy   = new Enemy(Content.Load <Texture2D>("Sprites/mine"), 100.0f, 100.0f);
            enemies = new List <Enemy>();
            Random    random    = new Random();
            Texture2D tmpSprite = Content.Load <Texture2D>("Sprites/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);
                Enemy temp = new Enemy(tmpSprite, rndX, rndY);
                enemies.Add(temp); // lägg till i listan
            }
        }