[英]How to use timer to check if event is occurred in Corona SDK
我想檢查對象是否不可見或不使用計時器,但是我使用的代碼無法正常工作。
這是我正在使用的代碼
local function listener( event )
print( "listener called" )
if (ball.isVisible == false ) then
ball.isVisible = true
ball.x = stargate_b.x
ball.y = stargate_b.y
end
end
timer.performWithDelay( 1000, listener )
我正在使用打印功能來檢查它是否循環,並且它不只是在程序啟動時僅打印一次
我嘗試將1000更改為0和1,但沒有任何反應
任何幫助請
提前致謝!
默認情況下,計時器僅運行一次。 嘗試timer.performWithDelay( 1000, listener, -1 )
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.