Exemplo n.º 1
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            Title = "basketball-game";

            OpenGL gl = args.OpenGL;

            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            RenderColor(gl);
            Render3D(gl);

            gl.LoadIdentity();
            //Manipulate Camera
            gl.LookAt(0 - mouseVector.x - movementVector.x, 0 + mouseVector.y - movementVector.y, 20.0f + zoom, 0 - movementVector.x, 0 + mouseVector.y, zoom, 0, 1, 0);
            //Then Translate
            gl.Translate(0.0f, 10.0f, -50.0f);

            //Draw 3D Objects
            #region Draw 3D Objects
            Ball.DrawBasketBall(gl, 60, 0, 0, 0);
            Ground.DrawCube(gl, 0, 120, 0);
            Pole.DrawCube(gl, 100, 100, 100);
            Board.DrawCube(gl, 0, 200, 200);
            RingEdge.DrawCube(gl, 0, 200, 200);

            RimNet.Draw(gl, 50, 50, 50);
            CenNet.Draw(gl, 40, 40, 40);

            //simulatedBall.DrawCircle(gl, 1);
            //Aiming Line Draw
            if (showLine)
            {
                if (isBallThrown)
                {
                    //Line.DrawLine(gl, Ball, Ball.Velocity, 1, 200, 60, 60);
                    Line.DrawSimulatedPath(gl, Ball, Ball.Velocity, 1, 200, 60, 60);
                }
                else
                {
                    //Line.DrawLine(gl, Ball, modifierVector, 1, 200, 60, 60);
                    Line2.DrawSimulatedPath(gl, simulatedBall, simulatedVector, 1, 200, 0, 0);
                }
            }
            //End Drawing Most 3D Objects
            #endregion

            #region Draw Text


            var angle = (Math.Truncate((Math.Atan(modifierVector.y / modifierVector.x) * 180 / Math.PI) * 100.0) / 100.0);
            //Above
            gl.DrawText(5, 630, 1, 0, 0, "Arial", 15, "Round: " + curRound);
            gl.DrawText(5, 600, 1, 0, 0, "Arial", 30, "Score: " + curScore);
            gl.DrawText(5, 570, 1, 0, 0, "Arial", 20, "Camera Movement Enabled: " + Keyboard.IsKeyToggled(toggleMovementKey).ToString());
            gl.DrawText(5, 480, 1, 0, 0, "Arial", 30, gameStage);

            //Below
            gl.DrawText(230, 20, 1, 0, 0, "Arial", 15, "Angle: " + angle);
            gl.DrawText(400, 5, 1, 0, 0, "Arial", 15, "Increments: " + increments);
            gl.DrawText(400, 20, 1, 0, 0, "Arial", 15, "Power: " + power);
            gl.DrawText(900, 20, 1, 0, 0, "Arial", 15, "Reset in: " + curCounter);


            #endregion


            showBall.Rotation += 5;
            #region WINDY Score when > 10
            //WINDY!!!!!!!!!!!!!! --- SCORE > 10
            if (curScore >= 10)
            {
                isWindy   = true;
                gameStage = "It's a bit windy";
                ObjectMesh Leave = new ObjectMesh()
                {
                    Scale = new Vector3(0.5f, 0.5f, 0),
                    Mass  = 0.3f
                };
                leaveRandGaussian = (float)Randomizer.Gaussian(-0, 10);
                leaveRandNorm     = (float)Randomizer.Generate(0.1f, 0.5f);
                Leave.Position    = new Vector3(leaveRandGaussian + 150, leaveRandGaussian, 30);
                Leave.Mass        = leaveRandNorm;
                Leaves.Add(Leave);
                foreach (var leaf in Leaves)
                {
                    leaf.DrawCube(gl, 0, 60, 0);
                    leaf.ApplyGravity();
                    leaf.ApplyForce(rightWindVector);
                    leaf.Velocity.Clamp(-0.2f, -0.2f, 0);
                    if (leaf.HasCollidedWith(Ground))
                    {
                        leaf.Position.y = Ground.Position.y + Ground.Scale.y + leaf.Scale.y;
                        leaf.Velocity.y = (-(leaf.Velocity.y));
                        leaf.ApplyFriction();
                    }
                    else
                    {
                        leaf.ApplyGravity();
                        leaf.ApplyFriction();
                    }
                }
            }
            #endregion

            #region Meteor Fell Score When > 20
            if ((curScore >= 20) && (enabledMetoer))
            {
                gameStage = "Some kind of meteor...";
                Meteor.DrawCircle(gl);
                Meteor.ApplyForce(meteorFallingVector);
                if (Meteor.Position.y <= -30)
                {
                    Meteor.Velocity.y *= 0;
                    Meteor.Position.y  = -30;
                    isMeteorFall       = true;
                }
            }
            #endregion

            #region Ball Thrown Code
            //You pressed Space
            if (isBallThrown)
            {
                curCounter--;
                if (curCounter > maxCounter - 2)
                {
                    Ball.Velocity = modifierVector / 1.5f;
                }
                Ball.Rotation += 10;
            }
            #endregion

            #region Scoring
            if (CenNet.Contains(Ball))
            {
                Console.WriteLine("Ball is in CenNet...");
                if (!isScored)
                {
                    curScore++;
                    randNorm     = (float)Randomizer.Generate(-10, 10);
                    randGaussian = (float)Randomizer.Gaussian(1, 2);
                    Console.WriteLine("Player Scores!");
                    isScored = true;
                }

                Ball.ApplyForce(RimNet.CalculateDragForce(Ball) * 1);
                Ball.ApplyForce(CenNet.CalculateDragForce(Ball) * 2);
            }
            #endregion

            #region Reset Code
            if (curCounter < 0)
            {
                Pole.Position.x     += randNorm;
                Board.Position.x    += randNorm;
                RingEdge.Position.x += randNorm;
                RimNet.x            += randNorm;
                CenNet.x            += randNorm;

                if ((randNorm < 1) && (randNorm > -1))
                {
                    Board.Position.y    += randGaussian;
                    RimNet.y            += randGaussian;
                    CenNet.y            += randGaussian;
                    RingEdge.Position.y += randGaussian;
                }

                if ((Pole.Position.x > 70) || (Pole.Position.x < 30))
                {
                    Pole.Position.x     = 50;
                    Board.Position.x    = 48.5f;
                    RingEdge.Position.x = 42.5f;
                    RimNet.x            = 45.5f;
                    CenNet.x            = 45.5f;
                }
                curCounter = maxCounter;
                isScored   = false;
                curRound++;
            }

            if (curCounter == maxCounter)
            {
                //isSpaceHeld = false;
                isBallThrown     = false;
                Ball.Velocity.x *= 0.0f;
                Ball.Velocity.y *= 0.0f;
                Ball.Position    = BallDefaultPos;
                randNorm        *= 0;
                randGaussian    *= 0;
                isScored         = false;
            }
            #endregion

            #region Controls
            // These controls only available when Ball is not yet thrown
            if (!isBallThrown)
            {
                //Increment Adjuster
                if (Keyboard.IsKeyDown(increaseKey) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    increments -= 0.1f;
                }
                else if (Keyboard.IsKeyDown(decreaseKey) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    increments += 0.2f;
                }
                increments = GameUtils.Constrain(increments, minIncrements, maxIncrements);

                //Adjust Power and Angle modified by Increments
                lineLength = modifierVector.GetLength();
                power      = (Math.Truncate(lineLength * 100.0) / 100.0);
                power     *= 10;


                if (Keyboard.IsKeyDown(upKey) && (power < 100) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    aimAngle          = Math.Atan((modifierVector.y) / (modifierVector.x));
                    modifierVector.x += increments * (float)Math.Cos(aimAngle);
                    modifierVector.y += increments * (float)Math.Sin(aimAngle);
                }
                if (Keyboard.IsKeyDown(downKey) && (power > 10) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    aimAngle          = Math.Atan((modifierVector.y) / (modifierVector.x));
                    modifierVector.x -= increments * (float)Math.Cos(aimAngle);
                    modifierVector.y -= increments * (float)Math.Sin(aimAngle);
                }
                if (Keyboard.IsKeyDown(rightKey) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    aimAngle         = Math.Atan(modifierVector.y / modifierVector.x);
                    aimAngle        -= (Math.PI / 180) + ((Math.PI / 90) * increments);
                    modifierVector.x = lineLength * (float)Math.Cos(aimAngle);
                    modifierVector.y = lineLength * (float)Math.Sin(aimAngle);
                }
                if (Keyboard.IsKeyDown(leftKey) && !Keyboard.IsKeyToggled(toggleMovementKey))
                {
                    aimAngle         = Math.Atan(modifierVector.y / modifierVector.x);
                    aimAngle        += (Math.PI / 180) + ((Math.PI / 90) * increments);
                    modifierVector.x = lineLength * (float)Math.Cos(aimAngle);
                    modifierVector.y = lineLength * (float)Math.Sin(aimAngle);
                }
            }

            //Play Ball
            if (Keyboard.IsKeyDown(shootKey))
            {
                isBallThrown = true;
            }

            //Restart
            if (Keyboard.IsKeyDown(resetKey) && (curCounter < maxCounter))
            {
                curCounter = -2;
            }

            if (Keyboard.IsKeyToggled(toggleLineKey))
            {
                showLine            = false;
                isDrawSimulatedPath = false;
            }
            else
            {
                showLine            = true;
                isDrawSimulatedPath = true;
            }

            //Force Random
            if (Keyboard.IsKeyDown(randomizeKey))
            {
                randNorm     = (float)Randomizer.Generate(-10, 10);
                randGaussian = (float)Randomizer.Gaussian(1, 2);
                curCounter   = -2;
            }

            //Add Score Cheat
            if (Keyboard.IsKeyDown(cheatKey))
            {
                randNorm     = (float)Randomizer.Generate(-10, 10);
                randGaussian = (float)Randomizer.Gaussian(1, 2);
                curCounter   = -2;
                curScore++;
            }

            if (Keyboard.IsKeyToggled(toggleMovementKey))
            {
                mouseVector = new Vector3(mousePos.x / (50 * (1 / sensitivity)), mousePos.y / (30 * (1 / sensitivity)), 0);
                eyex        = 0 - mouseVector.x + movementVector.x;
                eyey        = 0 + mouseVector.y - movementVector.y;
                eyez       += zoom;
                cenx        = 0 - movementVector.x;
                ceny        = 0 + mouseVector.y;
                cenz        = zoom;

                if (Keyboard.IsKeyDown(increaseKey))
                {
                    zoom += 1;
                }
                if (Keyboard.IsKeyDown(decreaseKey))
                {
                    zoom -= 1;
                }
                if (Keyboard.IsKeyDown(upKey))
                {
                    //movementVector.y -= 1;
                    zoom -= 1;
                }
                if (Keyboard.IsKeyDown(downKey))
                {
                    //movementVector.y -= -1;
                    zoom += 1;
                }
                if (Keyboard.IsKeyDown(leftKey))
                {
                    movementVector.x -= -1;
                }
                if (Keyboard.IsKeyDown(rightKey))
                {
                    movementVector.x -= 1;
                }
            }

            if (Keyboard.IsKeyDown(quitKey))
            {
                Environment.Exit(0);
            }
            #endregion

            #region Physics and Collision
            //Simulated Ball


            //Main Ball
            if (Ball.HasCollidedWith(Ground))
            {
                Ball.Velocity.y = (-(Ball.Velocity.y) / 2);
                Ball.Position.y = Ground.Position.y + Ground.Scale.y + Ball.Radius;
                Ball.ApplyFriction();

                if (isWindy)
                {
                    Ball.ApplyForce(rightWindVector);
                }
                if (isMeteorFall)
                {
                    Ball.ApplyForce(Meteor.CalculateAttraction(Ball));
                }
            }
            else
            {
                Ball.ApplyGravity(0.2f);
                Ball.ApplyFriction();
                if (isWindy == true)
                {
                    Ball.ApplyForce(rightWindVector);
                }
                if (isMeteorFall == true)
                {
                    Ball.ApplyForce(Meteor.CalculateAttraction(Ball));
                }
            }

            if (Ball.HasCollidedWith(Board))
            {
                if (Ball.Position.y > Board.Position.y + Board.Scale.y)
                {
                    Ball.Velocity.y = (-(Ball.Velocity.y) / 2);
                }
                Ball.Velocity.x = (-(Ball.Velocity.x) / 1.5f);
            }

            //Ball Collided with Meteor
            //Get distance between Ball and Metoer then check against its scale
            if (GameUtils.GetDistanceBetween(Meteor, Ball) < (Ball.Radius + Meteor.Radius) + 2.0f)
            {
                Ball.Velocity.x = (-(Ball.Velocity.x) / 1.5f);
                Ball.Velocity.y = (-(Ball.Velocity.y) / 1.5f);
            }

            if (Ball.HasCollidedWith(RingEdge))
            {
                if (Ball.Position.y > RingEdge.Position.y + RingEdge.Scale.y)
                {
                    Ball.Velocity.y = (-(Ball.Velocity.y) / 2);
                }
                Ball.Velocity.x = (-(Ball.Velocity.x) / 1.5f);
            }

            if (Ball.HasCollidedWith(Pole))
            {
                Ball.Velocity.x = (-(Ball.Velocity.x) / 1.5f);
            }
            #endregion
        }
Exemplo n.º 2
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            this.Title = "APLIMAT Final Exam";
            OpenGL gl = args.OpenGL;

            // Clear The Screen And The Depth Buffer
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            // Move Left And Into The Screen
            gl.LoadIdentity();
            gl.Translate(0.0f, 0.0f, -100.0f);


            if (Keyboard.IsKeyDown(Key.W))
            {
                playerCube.ApplyForce(Vector3.Up * speed);
            }

            if (Keyboard.IsKeyDown(Key.D))
            {
                playerCube.ApplyForce(Vector3.Right * speed);
            }

            if (Keyboard.IsKeyDown(Key.A))
            {
                playerCube.ApplyForce(Vector3.Left * speed);
            }
            if (Keyboard.IsKeyDown(Key.S))
            {
                playerCube.ApplyForce(Vector3.Down * speed);
            }

            Console.WriteLine("X:" + playerCube.Position.x + " Y:" + playerCube.Position.y);


            gl.Color(0.196078f, 0.6f, 0.8f);
            sea.Draw(gl);

            gl.Color(1.0, 1.0, 1.0);
            playerCube.Draw(gl);


            if (sea.Contains(playerCube))
            {
                var dragForce = sea.CalculateDragForce(playerCube) * 1f;
                playerCube.ApplyForce(dragForce);
                sea.changeColor(gl, 0, 0, 61);

                if (playerCube.Position.y <= sea1)
                {
                    playerCube.Position.y  = sea1;
                    playerCube.Velocity.y *= -1;
                }

                if (playerCube.Position.x >= sea3)
                {
                    playerCube.Position.x  = sea3;
                    playerCube.Velocity.x *= -1;
                }

                if (playerCube.Position.x <= sea2)
                {
                    playerCube.Position.x  = sea2;
                    playerCube.Velocity.x *= -1;
                }
            }


            if (!sea.Contains(playerCube))
            {
                if (playerCube.Position.y <= sea4)
                {
                    if (playerCube.Position.x <= sea2)
                    {
                        playerCube.Position.y  = sea4;
                        playerCube.Velocity.y *= -1;
                        playerCube.Velocity.x *= -1;
                    }


                    if (playerCube.Position.x >= -54 && playerCube.Position.x <= -28)
                    {
                        playerCube.Position.y  = 3.5f;
                        playerCube.Velocity.y *= -1;
                        playerCube.Velocity.x *= -1;
                    }

                    if (playerCube.Position.x >= -13 && playerCube.Position.x <= 13)
                    {
                        playerCube.Position.y  = 3.5f;
                        playerCube.Velocity.y *= -1;
                        playerCube.Velocity.x *= -1;
                    }

                    if (playerCube.Position.x >= 28 && playerCube.Position.x <= 54)
                    {
                        playerCube.Position.y  = 3.5f;
                        playerCube.Velocity.y *= -1;
                        playerCube.Velocity.x *= -1;
                    }

                    if (playerCube.Position.x >= sea3)
                    {
                        playerCube.Position.y  = sea4;
                        playerCube.Velocity.y *= -1;
                        playerCube.Velocity.x *= -1;
                    }
                }


                if (playerCube.Position.x >= sea2 && playerCube.Position.x <= sea3)
                {
                    if (playerCube.Position.y <= sea4)
                    {
                        if (playerCube.Position.x <= sea2)
                        {
                            playerCube.Position.x  = sea2;
                            playerCube.Velocity.x *= -1;
                        }



                        if (playerCube.Position.x >= sea3)
                        {
                            playerCube.Position.x  = sea3;
                            playerCube.Velocity.x *= -1;
                        }
                    }
                }
            }

            //cliff and sea
            #region


            gl.Color(0.36, 0.25, 0.20);
            cliff1.Draw(gl);
            cliff1.Scale = new Vector3(1 * cliff1.Mass / 4, 1 * cliff1.Mass / 2, 0);

            cliff2.Draw(gl);
            cliff2.Scale = new Vector3(1 * cliff2.Mass / 4, 1 * cliff2.Mass / 2, 0);

            cliff3.Draw(gl);
            cliff3.Scale = new Vector3(1 * cliff3.Mass / 1, 1 * cliff3.Mass / 8, 0);

            //middle cliff
            cliff4.Draw(gl);
            cliff4.Scale = new Vector3(1 * cliff4.Mass / 8, 1 * cliff4.Mass / 4, 0);

            cliff5.Draw(gl);
            cliff5.Scale = new Vector3(1 * cliff5.Mass / 8, 1 * cliff5.Mass / 4, 0);

            cliff6.Draw(gl);
            cliff6.Scale = new Vector3(1 * cliff6.Mass / 8, 1 * cliff6.Mass / 4, 0);
            #endregion

            #region sample for testing

            #endregion


            #region idea2

            #endregion

            #region keypress

            if (Keyboard.IsKeyDown(Key.W))
            {
                myCube.ApplyForce(Vector3.Up * speed);
            }

            if (Keyboard.IsKeyDown(Key.D))
            {
                myCube.ApplyForce(Vector3.Right * speed);
            }

            if (Keyboard.IsKeyDown(Key.A))
            {
                myCube.ApplyForce(Vector3.Left * speed);
            }
            if (Keyboard.IsKeyDown(Key.S))
            {
                myCube.ApplyForce(Vector3.Down * speed);
            }

            if (Mouse.LeftButton == MouseButtonState.Pressed)
            {
            }

            #endregion
        }
Exemplo n.º 3
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            this.Title = "APLIMAT Final Exam";
            OpenGL gl = args.OpenGL;

            // Clear The Screen And The Depth Buffer
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            // Move Left And Into The Screen
            gl.LoadIdentity();
            gl.Translate(0.0f, 0.0f, -100.0f);

            // Draw
            ocean.Draw(gl);
            gl.Color(1.0f, 1.0f, 1.0f);

            mousePos.Normalize();
            mousePos         *= 10;
            mGravity          = mousePos;
            mouseHitBox.Scale = new Vector3(1.5f, 1.5f, 1.5f);

            frames++;
            if (frames % 10 == 0 && count < 20)
            {
                CubeMesh cube = new CubeMesh();
                float    x    = (float)Randomizer.Generate(-20, 20);
                float    y    = (float)Randomizer.Generate(30, 35);
                float    z    = 0;
                cube.Position = new Vector3(x, y, z);
                float cubeScale = (float)Randomizer.Generate(0, 3);
                cube.Scale *= cubeScale;
                cube.Mass   = (float)Randomizer.Generate(2, 6);
                cubes.Add(cube);
                count++;
            }

            foreach (var c in cubes)
            {
                c.ApplyGravity();
                if (ocean.Contains(c))
                {
                    var dragForce = ocean.CalculateDragForce(c);
                    c.ApplyForce(dragForce);
                }
                if (c.Position.y <= yBottom)
                {
                    c.Velocity.y *= -1;
                    c.Velocity   /= 2;
                }
                if (c.HasCollidedWith(mouseHitBox))
                {
                    Console.WriteLine("HIT");
                    //mouseHitBox.Position.x--;
                    //c.Velocity *= -1;
                    c.Scale *= 0;
                }
                gl.Color(1.0f, 1.0f, 1.0f);
                c.Draw(gl);
            }

            if (Keyboard.IsKeyDown(Key.W))
            {
                mouseHitBox.Position.y++;
            }
            if (Keyboard.IsKeyDown(Key.A))
            {
                mouseHitBox.Position.x--;
            }
            if (Keyboard.IsKeyDown(Key.S))
            {
                mouseHitBox.Position.y--;
            }
            if (Keyboard.IsKeyDown(Key.D))
            {
                mouseHitBox.Position.x++;
            }

            float r = (float)Randomizer.Gaussian(0, 1);
            float g = (float)Randomizer.Generate(0, 1);
            float b = (float)Randomizer.Generate(0, 1);

            gl.Color(r, g, b);
            mouseHitBox.Draw(gl);
        }
Exemplo n.º 4
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            this.Title = "APLIMAT Final Exam";
            OpenGL gl = args.OpenGL;

            // Clear The Screen And The Depth Buffer
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            // Move Left And Into The Screen
            gl.LoadIdentity();
            gl.Translate(0.0f, 0.0f, -100.0f);


            Ocean.Draw(gl);
            gl.Color(1.0f, 1.0f, 1.0f);

            //gl.Color((byte)192, (byte)192, (byte)192);
            //Rock.Mass = (float)Gaussian.Generate(randMass.Generate(), randMass.Generate());
            //Rock.Scale = new Vector3(Rock.Mass, Rock.Mass, 0);
            //Rock.ApplyForce(Vector3.arcRight * 0.01f);
            //Rock.ApplyGravity();

            gl.Color(0, 0, 0);
            blackHole.Position.x = 0;
            blackHole.Position.y = -40;
            blackHole.Mass       = 5;
            blackHole.Scale      = new Vector3(blackHole.Mass, blackHole.Mass, 0);
            blackHole.Draw(gl);


            if (myRocks.Count <= 20)
            {
                for (int x = 0; x < 20; x++)
                {
                    myRocks.Add(new CubeMesh());
                    myRocks[x].Position = new Vector3(randPos.Generate(), randPos.Generate(), 0);
                    myRocks[x].Mass     = (float)Gaussian.Generate(randMass.Generate(), randMass.Generate());
                    myRocks[x].Scale    = new Vector3(myRocks[x].Mass, myRocks[x].Mass, 0);
                }
            }

            foreach (var rock in myRocks)
            {
                gl.Color((byte)192, (byte)192, (byte)192);
                rock.ApplyGravity();
                rock.Draw(gl);
                if (Ocean.Contains(rock))
                {
                    var dragForce = Ocean.CalculateDragForce(rock);
                    rock.ApplyForce(dragForce);
                    rock.ApplyForce(blackHole.CalculateAttraction(rock));
                }
                if (rock.Position.y <= -40)
                {
                    rock.Position.y  = -40;
                    rock.Velocity.y *= -1;
                }
            }

            counter++;

            //for (int x = 0; x < 10; x++)
            //{
            //    myRocks.Add(new CubeMesh());
            //    myRocks[x].Position = new Vector3(-50 - (x * 10), 30, 0);
            //    gl.Color((byte)192, (byte)192, (byte)192);
            //    myRocks[x].Mass = (float)Gaussian.Generate(randMass.Generate(), randMass.Generate());
            //    myRocks[x].Scale = new Vector3(Rock.Mass, Rock.Mass, 0);
            //    myRocks[x].ApplyGravity();
            //    myRocks[x].Draw(gl);
            //    if (Ocean.Contains(myRocks[x]))
            //    {
            //        var dragForce = Ocean.CalculateDragForce(myRocks[x]);
            //        //myRocks[x].ApplyForce(dragForce);
            //        //myRocks[x].ApplyForce(blackHole.CalculateAttraction(myRocks[x]));
            //    }
            //    if (myRocks[x].Position.y <= -40)
            //    {
            //        myRocks[x].Position.y = -40;
            //        myRocks[x].Velocity.y *= -1;
            //    }
            //}



            //if (counter >= 20)
            //{
            //    Rock.ApplyForce(Vector3.Right * 0.01f);
            //    Rock.ApplyForce(Vector3.Up * 0.01f);
            //    Rock.ApplyGravity();
            //    Rock.Draw(gl);
            //    myRocks.Add(Rock);
            //    if (Ocean.Contains(Rock))
            //    {
            //        var dragForce = Ocean.CalculateDragForce(Rock);
            //        Rock.ApplyForce(dragForce);

            //    }
            //}

            //if(counter == 120)
            //{
            //    counter = 0;
            //    Rock.Position = new Vector3(-75.0f, -8.0f, 0);
            //}


            //gl.Color(1.0, 1.0, 1.0);
            //bullet.Draw(gl);

            //if (Keyboard.IsKeyDown(Key.Space))
            //{
            //    Rock.Draw(gl);
            //}

            //if (Keyboard.IsKeyDown(Key.D))
            //{
            //    myCube.ApplyForce(Vector3.Right * speed);
            //}

            //if (Keyboard.IsKeyDown(Key.A))
            //{
            //    myCube.ApplyForce(Vector3.Left * speed);
            //}
            //if (Keyboard.IsKeyDown(Key.S))
            //{
            //    myCube.ApplyForce(Vector3.Down * speed);
            //}

            //if (Mouse.LeftButton == MouseButtonState.Pressed)
            //{

            //}

            //myCube.ApplyGravity();

            //if (myCube.Position.y <= -50)
            //{
            //    myCube.Position.y = -50;
            //    myc
            //}
        }