Corona SDK-检查对象是否已停止移动 [英] Corona SDK - Check if object has stopped moving
问题描述
我正在用Corona SDK制作游戏.我有一个移动的球(物理物体)要监视.当球停下时,我需要一个事件.如果将DrawMode
设置为hybrid
,当球停止移动时,我可以看到球变色.是否有任何内置事件可用来检查球是否停止移动或其他任何检查方法?感谢您的帮助.
Hi i am making a game with Corona SDK. I have a moving ball (physical object) to monitor. I need an event when the ball stops. If i set DrawMode
to hybrid
, i can see the ball changes color when it stops moving. Is there any built-in event available to check if the ball is stopped moving or any other way to check? Any help is appreciated.
推荐答案
好,找到我想要的东西.每个对象isAwake
都有一个布尔属性,该属性返回对象的清醒状态.如果球在移动,则返回true
,否则返回false
.现在,我正在使用1500ms的计时器检查此属性.
http://docs.coronalabs.com/api/type/Body/isAwake.html
Ok, found what i wanted. There is boolean property for each object isAwake
which returns the awake state of object. If ball is moving it returns true
otherwise false
. Now i am checking this property with 1500ms of timer.
http://docs.coronalabs.com/api/type/Body/isAwake.html
如果有人有更好的解决方案,请回复.
Please reply if anyone has better solution.
这篇关于Corona SDK-检查对象是否已停止移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!