private void MovePlayer() { var velocity = new Vector2(); if (InputHelper.AnyKeyPressed(KeyList.A, KeyList.Left)) { velocity.x -= 1; } if (InputHelper.AnyKeyPressed(KeyList.D, KeyList.Right)) { velocity.x += 1; } if (InputHelper.AnyKeyPressed(KeyList.W, KeyList.Up)) { velocity.y -= 1; } if (InputHelper.AnyKeyPressed(KeyList.S, KeyList.Down)) { velocity.y += 1; } velocity = velocity * _speed; MoveAndSlide(velocity); EmitSignal(nameof(PositionChanged), Position); }
public override void Update(GameTime gameTime, InputHelper input) { if (_gamemanager.Game.IsActive) { if (input.AnyKeyPressed(true)) { _gamemanager.SwitchState(GameState.MainMenuState); } } }
public override void Update(GameTime gameTime, InputHelper input) { if (!_introstarted) { _gamemanager.Audiomanager.PlaySong(_introsong, false); _introstarted = true; } if (_gamemanager.Game.IsActive) { if (input.AnyKeyPressed(true)) { _gamemanager.Audiomanager.StopPlaying(); _gamemanager.SwitchState(GameState.MainMenuState); } } }