예제 #1
0
 public void KillPlayer()
 {
     //resets player to the center and decreases their lives
     //Ends the game if the Player has no lives
     intPlayerLives--;
     player = new UserControlledSprite(Game.Content.Load <Texture2D>(@"Images/Player"),
                                       new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height - 75),
                                       new Point(68, 63), new Point(0, 0), 6, 1, new Vector2(5, 0), 5);
     if (intPlayerLives < 0)
     {
         ((Game1)Game).LevelUp(-1, intPlayerLives);
     }
 }
예제 #2
0
        protected override void LoadContent()
        {
            //load all images into textures
            goodBullet  = Game.Content.Load <Texture2D>(@"Images/GoodBullet");
            enemySprite = Game.Content.Load <Texture2D>(@"Images/Enemy");
            explosion   = Game.Content.Load <Texture2D>(@"Images/Explosion");
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);


            //construct the player
            player = new UserControlledSprite(Game.Content.Load <Texture2D>(@"Images/Player"),
                                              new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height - 75),
                                              new Point(68, 63), new Point(0, 0), 6, 1, new Vector2(5, 0), 5);

            //constructs the initial enemies
            for (int i = 0; i < enemyNum; ++i)
            {
                enemySpriteList.Add(new EnemySprite(enemySprite,
                                                    new Vector2(((Game1)Game).rnd.Next(0, Game.Window.ClientBounds.Width - 70), ((Game1)Game).rnd.Next(0, Game.Window.ClientBounds.Height - 120)),
                                                    new Point(68, 37), new Point(0, 0), 0, 10, new Vector2(((Game1)Game).rnd.Next(2, 6), ((Game1)Game).rnd.Next(2, 6))));
            }
        }
예제 #3
0
        protected override void LoadContent()
        {
            //load all images into textures
            goodBullet = Game.Content.Load<Texture2D>(@"Images/GoodBullet");
            enemySprite = Game.Content.Load<Texture2D>(@"Images/Enemy");
            explosion = Game.Content.Load<Texture2D>(@"Images/Explosion");
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //construct the player
            player = new UserControlledSprite(Game.Content.Load<Texture2D>(@"Images/Player"),
                new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height - 75),
                new Point(68, 63), new Point(0,0), 6, 1, new Vector2(5, 0), 5);

            //constructs the initial enemies
            for (int i = 0; i < enemyNum ; ++i)
            {
                enemySpriteList.Add(new EnemySprite(enemySprite,
                new Vector2(((Game1)Game).rnd.Next(0, Game.Window.ClientBounds.Width - 70), ((Game1)Game).rnd.Next(0, Game.Window.ClientBounds.Height - 120)),
                new Point(68, 37), new Point(0,0), 0, 10, new Vector2(((Game1)Game).rnd.Next(2, 6), ((Game1)Game).rnd.Next(2, 6))));
            }
        }
예제 #4
0
 public void KillPlayer()
 {
     //resets player to the center and decreases their lives
     //Ends the game if the Player has no lives
     intPlayerLives--;
     player = new UserControlledSprite(Game.Content.Load<Texture2D>(@"Images/Player"),
         new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height - 75),
         new Point(68, 63), new Point(0, 0), 6, 1, new Vector2(5, 0), 5);
     if (intPlayerLives < 0)
         ((Game1)Game).LevelUp(-1, intPlayerLives);
 }