what i will have it to work… it move from one directory to another without jump to Z and Y
var player: SKSpriteNode?
override func didMove(to view: SKView) {
self.anchorPoint = CGPoint(x: 0.5, y: 0.5)
player = SKSpriteNode(color: UIColor.cyan, size: CGSize(width: 90, height: 90))
player?.anchorPoint = CGPoint(x: 0.5, y: 0.5)
player?.position = CGPoint(x: 0, y: 0)
print("X: \(player?.position.x), Y: \(player?.position.y)")
self.addChild(player!)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches{
let location = touch.location(in: self)
player?.position.x = location.x
player?.position.y = location.y
print("X: \(player?.position.x), Y: \(player?.position.y)")
}
}