if(joystick && thumbSprite) {
[thumbSprite setPosition:joystick.stickPosition];
if (joystick.degrees == 0) {
backgroundSprite.rotation = joystick.degrees;
}
else {
CGFloat angle = joystick.degrees - 90.0f;
backgroundSprite.rotation = -1 * angle;
}
}
角度是0時,就直接給0,但不是0時,就轉90度,並加上個負號,這樣就能正常使用了
參考網址:
How do you rotate a CCSprite to face a touch
沒有留言:
張貼留言