RunningOutOfPower/RunPower/RunPower/InvincibleGame.cs
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
Allows the game to run logic such as updating the world,
checking for collisions, gathering input, and playing audio.
Allows the game to run logic such as updating the world checking for collisions gathering input and playing audio .
protected override void Update(GameTime gameTime)
        {
            var deltaTime = gameTime.GetElapsedSeconds();
            var gamepadState = GamePad.GetState(PlayerIndex.One);
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X == 0 &&
                GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y == 0)
            {
            }
            const float acceleration = 5f;
            if (gamepadState.IsButtonDown(Buttons.LeftThumbstickUp))
                _player.Accelerate(acceleration);
            if (gamepadState.IsButtonDown(Buttons.LeftThumbstickDown))
                _player.Accelerate(-acceleration);
            if (gamepadState.IsButtonDown(Buttons.LeftThumbstickLeft))               
                _player.Rotation -= deltaTime * 15f;
            if (gamepadState.IsButtonDown(Buttons.LeftThumbstickRight))
                _player.Rotation += deltaTime * 15f;
            if (gamepadState.IsButtonDown(Buttons.RightTrigger))
                _player.Fire();
            _camera.LookAt(_player.Position + _player.Velocity * 0.2f);
            _camera.Zoom = 1.0f - _player.Velocity.Length() / 500f;
            _entityManager.Update(gameTime);
            _previousGamePadState = gamepadState;
            base.Update(gameTime);
        }
protected override void Update ( GameTime gameTime ) { var deltaTime = gameTime . GetElapsedSeconds ( ) ; var gamepadState = GamePad . GetState ( PlayerIndex . One ) ; if ( GamePad . GetState ( PlayerIndex . One ) . Buttons . Back == ButtonState . Pressed || Keyboard . GetState ( ) . IsKeyDown ( Keys . Escape ) ) Exit ( ) ; if ( GamePad . GetState ( PlayerIndex . One ) . ThumbSticks . Left . X == 0 && GamePad . GetState ( PlayerIndex . One ) . ThumbSticks . Left . Y == 0 ) { } const float acceleration = 5f ; if ( gamepadState . IsButtonDown ( Buttons . LeftThumbstickUp ) ) _player . Accelerate ( acceleration ) ; if ( gamepadState . IsButtonDown ( Buttons . LeftThumbstickDown ) ) _player . Accelerate ( - acceleration ) ; if ( gamepadState . IsButtonDown ( Buttons . LeftThumbstickLeft ) ) _player . Rotation -= deltaTime * 15f ; if ( gamepadState . IsButtonDown ( Buttons . LeftThumbstickRight ) ) _player . Rotation += deltaTime * 15f ; if ( gamepadState . IsButtonDown ( Buttons . RightTrigger ) ) _player . Fire ( ) ; _camera . LookAt ( _player . Position + _player . Velocity * 0.2f ) ; _camera . Zoom = 1.0f - _player . Velocity . Length ( ) / 500f ; _entityManager . Update ( gameTime ) ; _previousGamePadState = gamepadState ; base . Update ( gameTime ) ; }
Allows the game to run logic such as updating the world,
checking for collisions, gathering input, and playing audio.
Allows the game to run logic such as updating the world checking for collisions gathering input and playing audio .
//if (_previousGamePadState.ThumbSticks.Left.X != gamepadState.ThumbSticks.Left.X || _previousGamePadState.ThumbSticks.Left.Y != gamepadState.ThumbSticks.Left.Y) //    _player.LookAt(_camera.ScreenToWorld(new Vector2(gamepadState.ThumbSticks.Left.X, gamepadState.ThumbSticks.Left.Y)));
gameTime
GameTime
Provides a snapshot of timing values.
Provides a snapshot of timing values .