简体   繁体   中英

Corona SDK transition.to and physics body not acting right

I've got this snippet that seems simple, but doesn't work right. I've got a ball that jumps on screen tap. It does jump on tap, but it seems as if the ball gets heavier with multiple taps and falls down a lot faster. So after about 10 taps it almost falls down off screen instantly. Anyone have any idea why?

local function screenTap (event)
  if ball.y > ceiling then
    transition.to(ball, {time=transitionTime,
                         x = ball.x,
                         y = ball.y - jumpHeight,
                         radius = 25})
  end
end

tapArea:addEventListener ("tap", screenTap)

In physics we don't use transitions. Use force:

myBody:applyForce( 500, 2000, myBody.x, myBody.y )

Two first two values are for force amount (x, y) and the next two defines single point where force is applied.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM