in my game there's a class for a "wall" that's moving to the left. I want to change the speed of it based on count i put in a touchesBegan class:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
count++
}
func startMoving() {
let moveLeft = SKAction.moveByX(-kDefaultXToMovePerSecond, y: 0, duration: 1 )
let move = SKAction.moveByX(-kDefaultXToMovePerSecond, y: 0, duration: 0.5)
if(count <= 10)
{
runAction(SKAction.repeatActionForever(moveLeft))
}
else
{
runAction(SKAction.repeatActionForever(move))
}
but it's not working. can you help?
Aucun commentaire:
Enregistrer un commentaire