In my game, my main character is a CCSprite. That CCSprite is controller by the UIAccelerometer, I enabled the accelerometer method by doing self.isAccelerometerEnabled = YES;
And then setting the updateInterval
to: 1/30
.
The problem is not my acceleration values not being actual good values but it has to do with my CCSprite not getting redrawn fast enough. So pretty much if my CCSprite moves many pixels per .1 second, the sprite starts to flicker and then the faster it gets the more it flickers.
I declared my acceleration values in my .h and set them in the Accelerometer delegate method then I set the position of the CCSprite in my game loop.
Any ideas why this might be happening?
Thanks!
Edit: Accelerometer code:
float accelX = (acceleration.x - [[NSUserDefaults standardUserDefaults] floatForKey:@"X-Calibrate"]);
rollingX = (accelX * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor));
AccelPoint.x += (rollingX*50);