I'm writing a SpriteKit game using Swift, and am using the following code to move my sprite - however, it doesn't seem to be updating velocity.dx:
func walk(isRight: Bool, speed: Float) {
var newV = (isRight ? 1 : -1) * 20 * speed;
let moveAction = SKAction.moveByX(newV, y: 0, duration: 2.0)
self.runAction(SKAction.repeatActionForever(moveAction), withKey: "walking")
println("self.physicsBody.velocity.dx: \(self.physicsBody.velocity.dx)")
}
Here's what I get in the console:
self.physicsBody.velocity.dx: 0.0
Is there something I need to do to get the moveByX to also update the velocity?