how can I make Accelerate event response immediately ?

I dont want the ball go out side of screen.

this is my code.
but the problem is,when the ball stop at top or bottom, then I try to let it go down(or go up),it will delay for about 1 sec !

anyone tell me why?
thanks a lot !

1
2
3
4
5
6
7
8
9
10
11
12
local function onAccelerate( event )
  dirx=event.xGravity
  diry=event.yGravity
end
 
local function enterframe(event)
  if((ball.y<10 and dirx <0) or (ball.y>310 and dirx >0))then
    ball:setLinearVelocity( diry*880, 0 )
  else
    ball:setLinearVelocity( diry*1880, newDirx*1880 )
  end
end
views:1413 update:2011/9/28 21:38:26
corona forums © 2003-2011