private void startTheGame()
        {
            scoreBoard = new Scoreboard();
            scoreBoard.Font = Content.Load<SpriteFont>("gameFont");
            
            int maxWidth = graphics.GraphicsDevice.Viewport.Width;
            int maxHeight = graphics.GraphicsDevice.Viewport.Height;

            enemyManager = new EnemyManager(this.Content.Load<Texture2D>("Enemy"), new Vector2(16), this.spriteBatch, maxWidth, maxHeight, scoreBoard);
            missileManager = new MissileManager(this.Content.Load<Texture2D>("Missile"), new Vector2(2.0f, 4.0f), this.spriteBatch, enemyManager, scoreBoard);


            //Setup player
            Texture2D playerTexture = Content.Load<Texture2D>("player");
            int playerX = graphics.GraphicsDevice.Viewport.Width / 2;
            int playerY = graphics.GraphicsDevice.Viewport.Height - 50;
            player = new Player(playerTexture, new Vector2(playerX,playerY), this.spriteBatch, missileManager);

            Logger.log(Log_Type.INFO, "max width "+playerX*2);
            Logger.log(Log_Type.INFO, "max height " + (playerY + 50));
        }
Beispiel #2
0
 public Player(Texture2D texture, Vector2 position, SpriteBatch theSpriteBatch, MissileManager missileManager)
     : base(texture, position, theSpriteBatch, position, 0.0f)
 {
     this.missileManager = missileManager;
 }
        private void startTheGame()
        {
            scoreBoard = new Scoreboard();
            scoreBoard.Font = Content.Load<SpriteFont>("gameFont");

            int maxWidth = graphics.GraphicsDevice.Viewport.Width;
            int maxHeight = graphics.GraphicsDevice.Viewport.Height;

            enemyManager = new EnemyManager(this.Content.Load<Texture2D>("Enemy"), new Vector2(16), this.spriteBatch, maxWidth, maxHeight, scoreBoard);
            missileManager = new MissileManager(this.Content.Load<Texture2D>("Missile"), new Vector2(2.0f, 4.0f), this.spriteBatch, enemyManager, scoreBoard);

            //Setup player
            Texture2D playerTexture = Content.Load<Texture2D>("player");
            int playerX = graphics.GraphicsDevice.Viewport.Width / 2;
            int playerY = graphics.GraphicsDevice.Viewport.Height - 50;
            player = new Player(playerTexture, new Vector2(playerX,playerY), this.spriteBatch, missileManager);

            Logger.log(Log_Type.INFO, "max width "+playerX*2);
            Logger.log(Log_Type.INFO, "max height " + (playerY + 50));
        }
Beispiel #4
0
 public Player(Texture2D texture, Vector2 position, SpriteBatch theSpriteBatch, MissileManager missileManager)
     : base(texture, position, theSpriteBatch, position, 0.0f)
 {
     this.missileManager = missileManager;
 }