Created
July 18, 2013 00:38
-
-
Save AyatoKinkori/6025826 to your computer and use it in GitHub Desktop.
cocos2dで、反時計周りにスプライトを回転させたかった時に試したこと ref: http://qiita.com/ayahito2828/items/4650f2f995a236f5042f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCSprite *rotete_object = [CCSprite initWithFile:@"hadaka_oyaji.png"]; | |
CCRotateBy *rotateby_clockwise = [CCRotateBy actionWithDuration:0.1 angle:180]; | |
[rotate_object runAction: [CCRepeatForever actionWithAction:rotateby_clockwise]]; | |
//これだと、時計回りに永遠に回転し続ける。 | |
CCRotateBy *rotateby_rev_clockwise = [CCRotateBy actionWithDuration:0.1 angle:-180]; | |
//マイナス、を付けている | |
[rotate_object runAction: [CCRepeatForever actionWithAction:rotateby_rev_clockwise]]; | |
//反時計周りに回転し続ける。 | |
/* 試してみてダメだった別例 */ | |
CCRotateTo *rotateto_failire = [CCRotateTo actionWithDuration:0.1 angle:360]; | |
[rotate_object runAction: [CCRepeatForever actionWithAction:rotateto_failure]]; | |
/* | |
RotateToは回転を最短距離で行おうとするため、360度回転させようとすると最短距離が | |
現在角度になってしまうためうんともすんとも言わなかった。 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment