在Corona SDK的transition.to过程中获取位置

我想知道在 Corona SDK 中的 lua 编程语言中,在 transition.to 动画期间是否可以获取精灵的 x 和 y 坐标?如果可以,我应该如何获取它?

点赞
用户1979583
用户1979583

使用 enterFrame 监听器在运行时检查它,或使用触发连续事件的 timer

使用 timer 方法:

local function checkPos_withTimer()
   print(yourObject.x)
   print(yourObject.y)
end
timer.performWithDelay(1, withTimer, -1)

或者使用 enterFrame 监听器:

local function checkin_frames()
   print(yourObject.x)
   print(yourObject.y)
end
Runtime:addEventListener("enterFrame", checkin_frames)

继续编码…… :)

2013-05-13 05:37:57