2015-08-08 75 views
0

我有一個無盡的亞軍遊戲,並有一個問題。基於分數的產卵塊

我該如何根據當前得分使塊產生得更快。得分越高,塊產生得越快。

塊菌種代碼:

blockStatuses["block1"] = BlockStatus(isRunning: false, timeGapForNextRun: random(), currentInterval: UInt32(0)) 

隨機()代碼:

func random() -> UInt32 { 
     var range = arc4random_uniform(50) 
     return range 
    } 

回答

1

有關添加當前score爲您random方法的參數是什麼?

func random(yourScore: yourScoreType) -> UInt32 { 
    var range = arc4random_uniform((UInt32)(50 - k * yourScore)) // k is a constant 
    return range 
}