public void Update(GameTime gameTime, Player player) { if (Visible) { UpdateMovement(player); Update(gameTime, _speed, _direction); } }
public Camera2D(Viewport viewport, Player player) { _zoom = 1.0f; Scroll = 1; _rotation = 0.0f; _pos = Vector2.Zero; Viewport = viewport; _playerToFollow = player; SimView = Matrix.Identity; View = Matrix.Identity; }
private void UpdateMovement(Player player) { var playerPos = new Vector2(player.SpritePosition.X, player.SpritePosition.Y); var movement = playerPos - SpritePosition; movement.Normalize(); _direction = movement; }
public void InitializeMultiplayerPlayers(int howManyPlayers) { switch (howManyPlayers) { case 2: _multiPlayerOne = new Player(); _multiPlayerTwo = new PlayerPuppet(); _otherPlayers.Add(_multiPlayerTwo); break; case 3: _multiPlayerOne = new Player(); _multiPlayerTwo = new PlayerPuppet(); _multiPlayerThree = new PlayerPuppet(); _otherPlayers.Add(_multiPlayerTwo); _otherPlayers.Add(_multiPlayerThree); break; case 4: _multiPlayerOne = new Player(); _multiPlayerTwo = new PlayerPuppet(); _multiPlayerThree = new PlayerPuppet(); _multiPlayerFour = new PlayerPuppet(); _otherPlayers.Add(_multiPlayerTwo); _otherPlayers.Add(_multiPlayerThree); _otherPlayers.Add(_multiPlayerFour); break; } }
/// <summary> /// Singleplayer Constructor /// </summary> public GameplayScreen() { TransitionOnTime = TimeSpan.FromSeconds(1.5); TransitionOffTime = TimeSpan.FromSeconds(0.5); _currentGameMode = GameMode.Singleplayer; SetDifficulty(); _singlePlayerPlayer = new Player(); _cam = new Camera2D(new Viewport(0, 0, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferWidth, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferHeight), _singlePlayerPlayer); _singlePlayerPlayer.GetCamera(_cam); _lZombies = new List<Zombie>(); AddZombies(_zombieModifier * _difficultyModifier); }