Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Как работает asyncCall:
- function testFunc()
- for i=1,100 do
- Core.yield(true) --ставит цикл на паузу, в след.фрейме приступит к след.итерации
- end
- print "прошло 100 фреймов" --цикл исполнялся 100 фреймов
- end
- Core.asyncCall(testFunc) --вызываем функцию testFunc, через 100 фреймов напечатает "прошло 100 фреймов"
- function testFunc2(ourSprite)
- for i=1,100 do
- ourSprite:setX(ourSprite:getX()+1)
- Core.yield(true)
- end
- end
- Core.asyncCall(testFunc2, ourPlayerSprite) --вызываем testFunc2 с передачей аргумента, в течение 100 фреймов будет смещать ourPlayerSprite на 1px вправо
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement