LoginSignup
3
3

More than 5 years have passed since last update.

cocos2dで、反時計周りにスプライトを回転させたかった時に試したこと

Posted at
rotate.m
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度回転させようとすると最短距離が
現在角度になってしまうためうんともすんとも言わなかった。
*/
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3