public void HandleInput(InputHelper inputHelper) { if (!IsGameOver) { cannon.HandleInput(inputHelper); ball.HandleInput(inputHelper); } else if (inputHelper.KeyPressed(Keys.Space)) { Reset(); } }
public override void HandleInput(InputHelper inputHelper) { // Color selection depending on buttonPressed if (inputHelper.KeyPressed(Keys.R)) { Color = Color.Red; } else if (inputHelper.KeyPressed(Keys.G)) { Color = Color.Green; } else if (inputHelper.KeyPressed(Keys.B)) { Color = Color.Blue; } double opposite = inputHelper.MousePosition.Y - Position.Y; double adjacent = inputHelper.MousePosition.X - Position.X; barrelRotation = (float)Math.Atan2(opposite, adjacent); }