Exemple #1
0
        public static Ball ballWithTexture(CCTexture2D aTexture)
        {
            Ball pBall = new Ball();
            pBall.InitWithTexture(aTexture);
            //pBall->autorelease();

            return pBall;
        }
Exemple #2
0
        public PongLayer()
        {
            m_ballStartingVelocity = new CCPoint(20.0f, -100.0f);

            m_ball = Ball.ballWithTexture(CCTextureCache.SharedTextureCache.AddImage(s_Ball));
            m_ball.Position = new CCPoint(160.0f, 240.0f);
            m_ball.Velocity = m_ballStartingVelocity;
            AddChild(m_ball);

            CCTexture2D paddleTexture = CCTextureCache.SharedTextureCache.AddImage(s_Paddle);

            List<object> paddlesM = new List<object>(4);

            Paddle paddle = Paddle.paddleWithTexture(paddleTexture);
            paddle.Position = new CCPoint(160, 15);
            paddlesM.Add(paddle);

            paddle = Paddle.paddleWithTexture(paddleTexture);
            paddle.Position = new CCPoint(160, 480 - 20f - 15);
            paddlesM.Add(paddle);

            paddle = Paddle.paddleWithTexture(paddleTexture);
            paddle.Position = new CCPoint(160, 100);
            paddlesM.Add(paddle);

            paddle = Paddle.paddleWithTexture(paddleTexture);
            paddle.Position = new CCPoint(160, 480 - 20.0f - 100);
            paddlesM.Add(paddle);

            m_paddles = paddlesM;

            for (int i = 0; i < m_paddles.Count; i++)
            {
                paddle = (Paddle)m_paddles[i];

                if (paddle == null) break;

                AddChild(paddle);
            }
            Schedule(new SEL_SCHEDULE(this.doStep));
        }
Exemple #3
0
        public PongLayer()
        {
            m_ballStartingVelocity = new CCPoint(20.0f, -100.0f);

            m_ball = Ball.ballWithTexture(CCTextureCache.SharedTextureCache.AddImage(s_Ball));
            m_ball.Velocity = m_ballStartingVelocity;
            AddChild(m_ball);

            CCTexture2D paddleTexture = CCTextureCache.SharedTextureCache.AddImage(s_Paddle);

            var paddlesM = new List<Paddle>(4);

            Paddle paddle = new Paddle(paddleTexture);
            paddlesM.Add(paddle);

            paddle = new Paddle(paddleTexture);
            paddlesM.Add(paddle);

            paddle = new Paddle(paddleTexture);
            paddlesM.Add(paddle);

            paddle = new Paddle(paddleTexture);
            paddlesM.Add(paddle);

			paddles = paddlesM;

            for (int i = 0; i < paddles.Count; i++)
            {
                paddle = paddles[i];

                if (paddle == null) break;

                AddChild(paddle);
            }
            Schedule(this.doStep);
        }