Reputation: 115
I have a ball that I want to move around (Spritekit) and I want to set a velocity so when the player move the ball then he moves his finger from the screen the ball will move and it will have it's own velocity depinding on some calculations
the question : this is my code , how can I know when the player is moving his finger from the screen ?!
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
if let touch = touches.first as? UITouch{
var location = touch.locationInNode(self)
ball6.position = location
}
Upvotes: 0
Views: 573
Reputation: 11435
Use this method:
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) {
//your code
}
Upvotes: 1