예제 #1
0
        public override void DidAccelerate(CCAcceleration pAccelerationValue)
        {
            CCDirector pDir = CCDirector.SharedDirector;
            CCSize winSize = pDir.WinSize;

            /*FIXME: Testing on the Nexus S sometimes m_pBall is NULL */
            if (m_pBall == null)
            {
                return;
            }

            CCSize ballSize = m_pBall.ContentSize;

            CCPoint ptNow = m_pBall.Position;
            CCPoint ptTemp = pDir.ConvertToUi(ptNow);

            ptTemp.X += (float) pAccelerationValue.X * 9.81f;
            ptTemp.Y -= (float) pAccelerationValue.Y * 9.81f;

            CCPoint ptNext = pDir.ConvertToGl(ptTemp);
            ptNext.X = MathHelper.Clamp(ptNext.X, (ballSize.Width / 2.0f), (winSize.Width - ballSize.Width / 2.0f));
            ptNext.Y = MathHelper.Clamp(ptNext.Y, (ballSize.Height / 2.0f), (winSize.Height - ballSize.Height / 2.0f));
            m_pBall.Position = ptNext;
        }
예제 #2
0
 public virtual void DidAccelerate(CCAcceleration pAccelerationValue)
 {
 }
예제 #3
0
 void HandleAccelerate(CCAcceleration acceleration)
 {
     if(gameSuspended)
         return;
     float accel_filter = 0.1f;
     bird_vel.X = bird_vel.X * accel_filter + (float)acceleration.x * (1.0f - accel_filter) * 500.0f;
 }
예제 #4
0
 public virtual void didAccelerate(CCAcceleration pAccelerationValue)
 {
     Debug.WriteLine("Layer2 accel");
 }
예제 #5
0
 public virtual void didAccelerate(CCAcceleration pAccelerationValue)
 {
     CCLog.Log("Layer2 accel");
 }