Beispiel #1
0
        public override void gameLogic()
        {
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.X))
            {
                ball2.applyImpulse(0, 0.01f);
            }

            //ball.move(1,1);
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.Up))
            {
                ball2.applyForce(0, -17);
                //soundBank.PlayCue("ring");
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.Down))
            {
                ball2.applyForce(0, 17);
                //soundBank.PlayCue("ring");
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.Left))
            {
                ball2.applyForce(-17, 0);
                //soundBank.PlayCue("ring");
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.Right))
            {
                ball2.applyForce(17, 0);
                //soundBank.PlayCue("ring");
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.D))
            {
                net.SignInGamer();
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.C))
            {
                net.CreateSession();
            }
            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.G))
            {
                net.FindSession();
            }


            if (isKeyPressed(Microsoft.Xna.Framework.Input.Keys.A))
            {
                ball.getBody().IsStatic = true;

                //soundBank.PlayCue("ring");
            }


            if (getGamePadButtons(Microsoft.Xna.Framework.PlayerIndex.One, Microsoft.Xna.Framework.Input.Buttons.A))
            {
                ball2.applyForce(-1, -1);
            }

            if (ball.physicsCollide(ball2))
            {
                //ball.height = 10;
                //ball.width = 10;
            }

            if (ball.simpleCollidesWith(ball2))
            {
                //     ball.height =100;
                //     s1.play();
            }
        }