怎麼理解SpriteKit中的waitForDuration:withRange:方法

我們知道SpriteKit的action中提供了兩種wait action。一種是通過waitForDuration:來等待一個確定的時間,另一種是通過waitForDuration:withRange:來等待一個隨機的時間。這個隨機的時間的範圍由兩個參數確定:duration表徵平均值,range表徵區間大小。

For example if you set duration to 5.0 and range to 2.0 you will get wait times between 4.0 and 6.0

對於duration爲5,range爲2的隨機等待時間,位於4.0和6.0之間。


參考:

http://stackoverflow.com/questions/21849431/sprite-kit-skaction-repeatactionforever-random-wait-duration





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章