// Update components and do other logic public override void Update() { // When you walking if (GameInput.ControllerMode) { if (GameInput.LeftStick.X != 0 && !MainGame.GAME_PAUSED) { HorizontalMovement(GameInput.LeftStick.X * maxSpeed); } else { StopMoving(); } } else { bool left = GameInput.InputDown(GameInput.Left); bool right = GameInput.InputDown(GameInput.Right); if ((left || right) && !MainGame.GAME_PAUSED) { HorizontalMovement(((right ? 1 : 0) - (left ? 1 : 0)) * maxSpeed); } else { StopMoving(); } } // Check if paused, if not perform stuff if (!MainGame.GAME_PAUSED) { // Jumping controlls if (GameInput.InputPressed(GameInput.Jump)) { jumpBuffer = 3; } if (physics.Grounded) { if (jumpBuffer > 0) { Jump(); } } if (!GameInput.InputDown(GameInput.Jump)) { physics.Velocity.Y = Math.Max(physics.Velocity.Y, -minJumpHeight); } jumpBuffer--; ledgeBuffer--; // Mining and attacking miningTool.DetermineTarget(); miningTool.Attack(); miningTool.Dig(); // ACtivate object that is touched if (GameInput.InputPressed(GameInput.Dig)) { if (ObjectAtPosition <IActivatable>(Position) is IActivatable IA) { IA.Activate(); } } } MainGame.GAME_SPEED = GameMath.Lerp(MainGame.GAME_SPEED, targetSpeed ? 1 : .25f, .1f); if (GameInput.KeyPressed(Keys.P)) { targetSpeed = !targetSpeed; } // Update components base.Update(); }