Example #1
0
 public void HandleInput(InputHelper inputHelper)
 {
     if (!IsGameOver)
     {
         cannon.HandleInput(inputHelper);
         ball.HandleInput(inputHelper);
     }
     else if (inputHelper.KeyPressed(Keys.Space))
     {
         Reset();
     }
 }
Example #2
0
        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);
        }