Exemplo n.º 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);
            sprites      = new List <Sprite>();
            bullet       = new Bullet(Vector2.Zero, Content.Load <Texture2D>("Sprites/bullet"));
            player       = new Player(new Vector2(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100), Content.Load <Texture2D>("Sprites/player"), bullet.Clone() as Bullet);
            Font         = Content.Load <SpriteFont>("Font");
            spawnManager = new EnemySpawnManager(new Enemy(new Vector2(200, -30), Content.Load <Texture2D>("Sprites/player"), bullet.Clone() as Bullet));
            sprites.Add(player);

            powerups.Add(new Triple(Vector2.Zero, Content.Load <Texture2D>("Sprites/PowerUp/puTriple")));
            powerups.Add(new Rapid(Vector2.Zero, Content.Load <Texture2D>("Sprites/PowerUp/rapid")));
            powerups.Add(new Swirl(Vector2.Zero, Content.Load <Texture2D>("Sprites/PowerUp/swirl")));
            hpPower = new hpUp(Vector2.Zero, Content.Load <Texture2D>("Sprites/PowerUp/hp"));

            hpTex      = Content.Load <Texture2D>("Sprites/healthBar");
            ammoTex    = Content.Load <Texture2D>("Sprites/ammo");
            background = new Background(Vector2.Zero, Content.Load <Texture2D>("Sprites/background"));
            sprites.Add(background);

            menuScreen = Content.Load <Texture2D>("Menu/menuscreen");
            helpScreen = Content.Load <Texture2D>("Menu/helpscreen");

            Play          = new Button(Content.Load <Texture2D>("Menu/play-unselected"), Content.Load <Texture2D>("Menu/play-selected"), new Vector2(0, 240));
            Play.OnClick += Play_Click;

            Exit          = new Button(Content.Load <Texture2D>("Menu/exit-unselected"), Content.Load <Texture2D>("Menu/exit-selected"), new Vector2(0, 400));
            Exit.OnClick += Exit_Click;

            Help          = new Button(Content.Load <Texture2D>("Menu/help-unselected"), Content.Load <Texture2D>("Menu/help-selected"), new Vector2(0, 320));
            Help.OnClick += Help_Click;
        }
Exemplo n.º 2
0
 private void spawnPowerUp(Vector2 position)
 {
     if (rnd.Next(5) == 1)
     {
         hpUp hpup = hpPower.Clone() as hpUp;
         hpup.setPosition(position);
         sprites.Add(hpup);
     }
     else
     {
         Powerup pUp = powerups[rnd.Next(powerups.Count)].Clone() as Powerup;
         pUp.setPosition(position);
         sprites.Add(pUp);
     }
 }