를 이동하지 (스위프트 3)노드
import SpriteKit
import GameplayKit
class GameScene: SKScene {
var object = SKSpriteNode()
override func didMove(to view: SKView) {
object = self.childNode(withName: "dot") as! SKSpriteNode
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
object.run(SKAction.move(to: location, duration: 0.3))
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
object.run(SKAction.move(to: location, duration: 0.3))
}
}
override func update(_ currentTime: TimeInterval) {
}
}
이 코드는하지만 ... 난 단지 캔트, 저 장면 주위에 "점"을 끌 수 있도록 설계되었습니다! 그것은 움직이지 않을 것이다! 온라인에서 보았지만 아무것도 찾을 수 없습니다. 이 코드를 새로운 프로젝트에 붙여 넣으려고했는데 거기에서 작업했지만 제 "점"노드를 삭제하고 바꾸는 것조차도 내 주 프로젝트에서 도움이되지 않는 것 같습니다.
그래서 ... 어떤 아이디어입니까?
은 말 그대로 미친 –