Ejemplo n.º 1
0
        /// <summary>
        /// Create a set of paddles lined up in y, that either ract to left or right trigger
        /// </summary>
        /// <param name="num">number of paddels in a row</param>
        /// <param name="xPosition">xLocation of the paddles</param>
        /// <param name="initYPosition">First yPosition of the paddles</param>
        /// <param name="yDistance">How far are the paddles away from each other</param>
        public PaddleSet(PaddleSetType type, int num, float xPosition, float initYPosition, float yDistance)
        {
            mPaddles = new Paddle[num];
            float y = initYPosition;

            for (int i = 0; i < num; i++)
            {
                if (PaddleSetType.eLeftSet == type)
                {
                    mPaddles[i] = new LeftPaddle(new Vector2(xPosition, y));
                }
                else
                {
                    mPaddles[i] = new RightPaddle(new Vector2(xPosition, y));
                }

                y += yDistance;
            }
        }
Ejemplo n.º 2
0
        protected override void InitializeWorld()
        {
            World.SetWorldCoordinate(new Vector2(0, 0), kWorldWidth);
            mHit = mMissed = 0;

            mLeftPaddles  = new Paddle[kNumPaddlesPerSide];
            mRightPaddles = new Paddle[kNumPaddlesPerSide];
            float y = kYDist;
            int   i = 0;

            while (i < kNumPaddlesPerSide)
            {
                // allocate the left/right paddles
                mLeftPaddles[i]  = new LeftPaddle(new Vector2(kLeftPosition, y));
                mRightPaddles[i] = new RightPaddle(new Vector2(kRightPosition, y));

                i++;
                y += kYDist;
            }
            mBall = new MyBall();
        }