public void HandleInput(InputState input, Color[] levelData) { PlayerIndex playerIndex; if (direction.X != 0) lastDirection = direction; direction.X = 0; if (IsActive) { if (state == State.Walking && getColor (leftCorner, levelData) != groundColor && input.IsKeyPressed (Keys.Left, null, out playerIndex) && leftCorner.X > 0) direction.X = -1; else if (state == State.Walking && getColor (rightCorner, levelData) != groundColor && input.IsKeyPressed (Keys.Right, null, out playerIndex) && rightCorner.X < 799) direction.X = 1; if (state == State.Walking && input.IsNewKeyPress (Keys.Enter, null, out playerIndex)) jump (); if (input.IsKeyPressed (Keys.Up, null, out playerIndex)) { angle -= Math.PI / 128; if (angle < -Math.PI / 2) angle = -Math.PI / 2; } if (input.IsKeyPressed (Keys.Down, null, out playerIndex)) { angle += Math.PI / 128; if (angle > Math.PI / 2) angle = Math.PI / 2; } if (input.IsKeyPressed (Keys.Space, null, out playerIndex) && power < 80) { power += 1; if (power == 80) { fire (); power = 0; } } if (input.KeyWasReleased (Keys.Space, null, out playerIndex)) { fire (); power = 0; } } }