1
Im試圖將旋轉添加到Sprite 90度,所以如果我點擊它上面,它將向90度方向移動一個面向該方向的面。像蛇遊戲一樣思考。如何在SpriteKit中將Sprite旋轉90度
在我的touchesBegan方法,我可以得到雪碧轉動,但是它似乎翻轉本身,而不是真正去90度,更喜歡180
任何想法,爲什麼,我怎麼能得到它的指向正確的方向。
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
let touch = touches.first as UITouch!
let touchLocation = touch.locationInNode(self)
sceneTouched(touchLocation)
if (car.position.x > touchLocation.x) {
car.zRotation = CGFloat(M_PI_2)
} else {
car.zRotation = CGFloat(-M_PI_2)
}
}