Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:08+00:00 2026-05-23T13:29:08+00:00

we are doing a game with moving objects around frame-by-frame and also using accelerometer.

  • 0

we are doing a game with moving objects around frame-by-frame and also using accelerometer.

We have hooked on two events – about drawing the frame and for the acc.

The problem is, after we receive the acc event, we immediately put the x value in a variable.

Then we use this variable to move an object on the screen, but there is CONSIDERABLE slow down. ( I turn the phone, and after a second the object is moving properly, but a second is just way too much for a game, I expect immediate response).

What am I doing wrong? Is there another workaround to do this, or can I give some params to the accelerometer?

Unfortunately this is a serious problem – a real blocker. If this does not work, I have to find another solution (not Corona) for implementing the game.

Thanks in advance!!!
Danail

PS: here’s some source:

local lastXGravity = 0

local function move(event) 
        eventTime=event.time
        elapsedTime = eventTime - lastDrawTime
        lastDrawTime = eventTime

        xSpeed = lastXGravity
        local xMoved = xSpeed * elapsedTime
        object.x= object.x + xMoved
end

function acc(event)   
        lastXGravity = event.xGravity
end

Runtime:addEventListener("accelerometer", acc)
Runtime:addEventListener( "enterFrame", move )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:29:08+00:00Added an answer on May 23, 2026 at 1:29 pm

    The guys at Ansca’s forum just got this out:

    system.setAccelerometerInterval( 50 )
    

    This didn’t quite actually did the trick, but

    system.setAccelerometerInterval( 100 ) — warning – battery drainer!!

    did it 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a 2d space game with many moving objects. I have already
I want to get started doing some game development using Microsoft's XNA. Part of
Good day! I am doing a game and I want it to have a
I doing a function in Javascript like the VisualBasic DateDiff. You give two dates
When doing thread synchronization in C# should I also lock an object when I
I have a 'GameBoard' class and am doing a search on it. I want
I have a GitHub project which does the same thing (a simple RogueLike game
I started doing game for my school project in C++ with SDL library. But
I'm doing a dots game on the iphone for fun ( just simulator) and
im doing a level editor for my game and i need to save the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.