예제 #1
0
        protected override void HandleKey(KeyHandler handler)
        {
            base.HandleKey(handler);

            if (handler.IsKeyPressed(Key.Space))
            {
                if (ball.Velocity.Length() == 0)
                {
                    ball.AddForce(new Vector2f(2000000, 0));
                }
            }
        }
예제 #2
0
        protected override void HandleKey(KeyHandler handler)
        {
            base.HandleKey(handler);

            if(handler.IsKeyPressed(Key.Space))
            {
                Random r = new Random();
                double rand = r.NextDouble();
                Body body2 = new Body("Mover1", new Box(40.0f, 40.0f), 300.0f);
                body2.SetPosition(- 50, (float) (((rand * 50) + 150)));
                world.Add(body2);
                body2.AdjustAngularVelocity(1);
                body2.AdjustVelocity(new Vector2f(200, (float) (rand * 200)));
            }
        }
예제 #3
0
 protected virtual void HandleKey(KeyHandler handler)
 {
 }