I'm making a little game, and I'm now stuck with the following problem.
I'm running an action (followPath type) on a particular node :
let followTrack: SKAction = SKAction.followPath(ballPath!.CGPath, duration: ACTION_SPEED)
movingBall.runAction(followTrack)
But during the animation, if the node collide with another one (like a wall for exemple), the animation stops and there is no collision animation.
I tried some things like :
func didBeginContact(contact: SKPhysicsContact) {
var firstBody: SKPhysicsBody = contact.bodyA
var secondBody: SKPhysicsBody = contact.bodyB
firstBody.node?.removeAllActions()
secondBody.node?.removeAllActions()
}
But there is no collision either (I guess that's because velocity is (0,0))
Is there anyway to handle this case ? (I don't especially need a swift answer, an objective-C or generic answer would be great too !)
来源:https://stackoverflow.com/questions/26909774/skspritenode-handling-collision-during-skaction