示例#1
0
 private PlayerManager()
 {
     player1 = null;
     player2 = null;
     currPlayer = null;
     possibleHiScore = 0;
 }
        public SpaceInvadersScreen(string title, Game parent)
            : base(title, parent)
        {
            backgroundMusic.Play();
            SetupHUD();

            laneWidth = parent.Size.X / numberOfLanes;

            player = new Player(new Vector2f(Parent.Size.X * 0.5f, parent.Size.Y - 20), AssetsManager.Textures["ship"]);
            player.Scale *= 0.5f;

            playerHitSound.SoundBuffer = AssetsManager.Sounds["playerHit"];
            explosionSound.SoundBuffer = AssetsManager.Sounds["explosion"];

            spriteBatchTexture = new RenderTexture((uint)(parent.Size.X), (uint)(parent.Size.Y));
            spriteBatch = new Sprite(spriteBatchTexture.Texture);
        }
示例#3
0
 private void setToPlayer2()
 {
     if (player2 != null && player2.Lives > 0)
     {
         currPlayer = player2;
         currPlayer.hookupManagers();
     }
     else
     {
         if (player2.Score > possibleHiScore)
             possibleHiScore = player2.Score;
         player2 = null;
         checkGameOver();
     }
 }
示例#4
0
 /// <summary>
 /// Creates the player, its image and the spriteBatch.
 /// </summary>
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     imagePlayer = game.Content.Load<Texture2D>("player");
     player = new Player(imagePlayer.Height, imagePlayer.Width,
                         GraphicsDevice.Viewport.Width,
                         GraphicsDevice.Viewport.Height, 8F);
     base.LoadContent();
 }
示例#5
0
 public void KillPlayer(Player player)
 {
     EnterState(GameState.PlayerDead);
     player.HitPlayer();
 }