Skip to content

Instantly share code, notes, and snippets.

@veeneck
Created January 26, 2015 14:35
Show Gist options
  • Save veeneck/9ae95b8d4b59280f916d to your computer and use it in GitHub Desktop.
Save veeneck/9ae95b8d4b59280f916d to your computer and use it in GitHub Desktop.
Class timing
class CutsceneAction {
var finishEarly : Bool = false
func timingFunc(time:Float) -> Float {
if(self.finishEarly) {
return 1.0
}
else {
return time
}
}
func runAction(object:SKNode, action:SKAction) {
action.timingFunction = self.timingFunc
object.runAction(action)
}
/// Call this on touch, or for any other reason, from scene
func skip() {
self.finishEarly = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment