Exemple #1
0
        void update(ulong frame)
        {
            //System.Windows.Forms.MessageBox.Show(position.Y.ToString());
            if (a)
            {
                if (Keyboard.GetState().IsKeyDown(Key.D))
                {
                    physics.applyForce(Vector2d.UnitX / 6);
                }
                if (Keyboard.GetState().IsKeyDown(Key.A))
                {
                    physics.applyForce(-Vector2d.UnitX / 6);
                }

                if (Keyboard.GetState().IsKeyDown(Key.W))
                {
                    physics.applyForce(Vector2d.UnitY);
                }
                if (Keyboard.GetState().IsKeyDown(Key.S))
                {
                    physics.applyForce(-Vector2d.UnitY);
                }
            }
            else
            {
                if (Keyboard.GetState().IsKeyDown(Key.Right))
                {
                    physics.applyForce(Vector2d.UnitX / 6);
                }
                if (Keyboard.GetState().IsKeyDown(Key.Left))
                {
                    physics.applyForce(-Vector2d.UnitX / 6);
                }

                if (Keyboard.GetState().IsKeyDown(Key.Up))
                {
                    physics.applyForce(Vector2d.UnitY);
                }
                if (Keyboard.GetState().IsKeyDown(Key.Down))
                {
                    physics.applyForce(-Vector2d.UnitY);
                }
            }

            if (Keyboard.GetState().IsKeyDown(Key.Space))
            {
                System.Diagnostics.Debug.Close();
            }
            if (Keyboard.GetState().IsKeyDown(Key.Escape))
            {
                Game.quit();
            }
            //physics.applyForce(-0.2 * Vector2d.UnitY);
            //  System.Diagnostics.Debug.WriteLine(physics.angularSpeed);
        }