Created
June 27, 2014 13:44
-
-
Save is8r/83eebccefd2289eb453d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// PuruBtn.m | |
#import "PuruBtn.h" | |
@implementation PuruBtn | |
- (void)_init | |
{ | |
[self schedule:@selector(tick:) interval: 1.0f];//初回は一秒後に実行 | |
} | |
- (void)tick:(ccTime) dt | |
{ | |
//プルプルさせる処理 | |
id step0; | |
id step1; | |
id easeAction; | |
step0 = [CCRotateBy actionWithDuration:0.1f angle:3]; | |
step1 = [CCRotateBy actionWithDuration:0.6f angle:-3]; | |
easeAction = [CCEaseElasticOut actionWithAction:step1]; | |
[self runAction:[CCSequence actions:step0, easeAction, nil]]; | |
//次回の実行をランダムで設定 | |
srand(rand()%99 + time(nil)); | |
float time = rand()%3; | |
[self unschedule:@selector(tick:)]; | |
[self schedule:@selector(tick:) interval: time];// | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment