Exemple #1
0
        public override void Update(GameTime argTime)
        {
            base.Update(argTime);

            mPlayerLeft.Update(argTime);
            mPlayerRight.Update(argTime);
            mBallObj.Update(argTime);

            if (mBallObj.Transform.Position.Y + mBallObj.Radius >= Game.Height || mBallObj.Transform.Position.Y - mBallObj.Radius <= 0)
            {
                mBallObj.Velocity *= mVectDirBallY;
            }
            else if (mBallObj.Transform.Position.X + mBallObj.Radius >= Game.Width)
            {
                mPlayerLeft.Score++;
                Reset();
            }
            else if (mBallObj.Transform.Position.X - mBallObj.Radius <= 0)
            {
                mPlayerRight.Score++;
                Reset();
            }
            else
            {
                CollisionPlayerBall(mPlayerRight, mBallObj, true);
                CollisionPlayerBall(mPlayerLeft, mBallObj, false);
            }
        }