示例#1
0
 public override void HandleInput(InputHelper inputHelper)
 {
     if(inputHelper.MouseLeftButtonPressed() && !shooting)
     {
         shooting = true;
         velocity = (inputHelper.MousePosition - position) * speed;
         ballShot.Play();
         Color = Painter.GameWorld.Cannon.Color;
     }
 }
示例#2
0
        public override void HandleInput(InputHelper inputHelper)
        {
            //Handle the color
            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;

            //Handle the angle
            double opposite = inputHelper.MousePosition.Y - position.Y;
            double adjacent = inputHelper.MousePosition.X - position.X;

            angle = (float)Math.Atan2(opposite, adjacent);
        }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            inputHelper = new InputHelper();
            IsMouseVisible = true;

            random = new Random();

            base.Initialize();
        }
示例#4
0
 public void HandleInput(InputHelper inputHelper)
 {
     cannon.HandleInput(inputHelper);
     ball.HandleInput(inputHelper);
 }
示例#5
0
 public void HandleInput(InputHelper inputHelper)
 {
     cannon.HandleInput(inputHelper);
     ball.HandleInput(inputHelper);
 }
 public virtual void HandleInput(InputHelper inputHelper)
 {
 }
示例#7
0
 public virtual void HandleInput(InputHelper inputHelper)
 {
 }