コード例 #1
0
ファイル: Ball.cs プロジェクト: golddevelopment/Painter
 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
ファイル: Cannon.cs プロジェクト: golddevelopment/Painter
        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
ファイル: Painter.cs プロジェクト: golddevelopment/Painter
        /// <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
ファイル: GameWorld.cs プロジェクト: Njuby/Painter
 public void HandleInput(InputHelper inputHelper)
 {
     cannon.HandleInput(inputHelper);
     ball.HandleInput(inputHelper);
 }
コード例 #5
0
ファイル: GameWorld.cs プロジェクト: golddevelopment/Painter
 public void HandleInput(InputHelper inputHelper)
 {
     cannon.HandleInput(inputHelper);
     ball.HandleInput(inputHelper);
 }
コード例 #6
0
 public virtual void HandleInput(InputHelper inputHelper)
 {
 }
コード例 #7
0
 public virtual void HandleInput(InputHelper inputHelper)
 {
 }