system.setAccelerometerInterval and lag

Hi everybody,

I’m currently developing a game (for commercial release), and I have a big issue with the accelerometer.

The game is supposed to be as responsive as doodle jump, and I managed to make it responsive until I add more display objects.

It seems that I cannot setup the accelerometer upper than 60hz (system.setAccelerometerInterval( 60.0 )) or I have, on device, a kind of lag.

I use event.xGravity * 800 as the horizontal speed for my sprite.

The lag is that the game is like un-synchcronized with the accelerometer. It’s like recording and replaying accelerometer events with 2 seconds delay…

It’s better if I reduce the amount of display object, and it’s awful if I add Text object (and update it each frame, like a score).

My questions are :

  • Is the accelerometer using a kind of event queue??
  • Can I use event.deltaTime to reduce the accelerometer interval? I tried, but I cannot understand how to use it. If I multiply event.xGravity by event.deltaTime, I got 0…
  • Is there another way to make a sprite move horizontally like a doodle jump sprite?
  • Who’s going to win the french presidential elections? Hum… not this one.

David [import]uid: 77660 topic_id: 20864 reply_id: 320864[/import]

Hi David. Maybe there are other things going on that could be optimized in the code perhaps? [import]uid: 84637 topic_id: 20864 reply_id: 82298[/import]

I reduced the number of display objects and setup the accelerometer with:

system.setAccelerometerInterval( 60.0 )

And it’s work quite well (with some lags sometime). [import]uid: 77660 topic_id: 20864 reply_id: 90447[/import]