I'm new to swift, and I'm creating a random generated game using NSTimer i used this function for timer http://ift.tt/1Npo9HS
my game was working fine until i got a problem with updating the speed of my game depending on the player score using timer, so i can't change the speed of my game
my Gamescene class :
let myGame = Timer.repeat(after: 1) {
//my generated game code here
}
myGame.start()
my game updater function :
let LevelUpdate = Timer.repeat(after: 0.1) {
//update my game and verify player score
here an example of i want to achieve
if(self.score >= 0 && self.score <= 1000){
myGame.delay = 1.0 // Speedup the time of the game
}
}
Please i need to find a way of speeding up my game by player score.
Aucun commentaire:
Enregistrer un commentaire