I'm using the following methods to make my character jump:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
if onGround && !gameOver {
self.character.physicsBody?.applyImpulse(CGVectorMake(0, 75))
self.onGround = false
}
}
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
}
This works fine, but I want to make the character jump a certain height based on the length of the touch until a maximum. I've tried something with frame durations but this didn't work.
How can I make the character jump based on touch length until a maximum height?