Beispiel #1
0
        private void DoGame()
        {
            //timer
            time += timer.Interval;

            //if collision happend
            if (hasCollision)
            {
                rectangle.acceleration = collision.ResultAcceleration(circle.acceleration, standgrav, theta, (Circle)circle, (Shapes.Rectangle)rectangle);

                circle.acceleration = rectangle.acceleration;

                //acceleration 0;
                if ((rectangle.acceleration <= 0))
                {
                    rectangle.acceleration = 0;
                }

                //set values
                rectangle.speed = rectangle.acceleration * (time / 1000.0d);
                circle.speed    = rectangle.speed;
            }
            //before collision happened
            else
            {
                circle.acceleration = collision.Acceleration(standgrav, theta, 0);

                if (collision.Acceleration(standgrav, theta, rectangle.staticFriction) > 0)
                {
                    rectangle.acceleration = collision.Acceleration(standgrav, theta, rectangle.kineticFriction);
                }

                //set values
                circle.speed    = circle.acceleration * (time / 1000.0d);
                rectangle.speed = rectangle.acceleration * (time / 1000.0d);
            }
        }