I have an if statement that is returning the wrong value and is therefore running code it shouldn't. I am so confused over this, the value of currentPowerup is not empty so it should not be running the code.
override func update(_ currentTime: TimeInterval) {
//called every frame
if GameScene.score >= 1{
//When it prints this, currentPower is "rocket" but it then goes ahead with the if statement resulting in true when it is false
print(currentPowerup)
if currentPowerup == ""{
if HasPowerup == false{
createPowerupLocation()
HasPowerup = true
}
}
}
}
Thanks
Aucun commentaire:
Enregistrer un commentaire