Skip to content

Instantly share code, notes, and snippets.

View is8r's full-sized avatar
🙂

Yu Ishihara is8r

🙂
View GitHub Profile
// PuruBtn.h
#import "CCSpriteBtn.h"
@interface PuruBtn : CCSpriteBtn{}
@end
PuruBtn *b = [[PuruBtn alloc] initWithFiles:@"b_border80.png" ro:@"b_border80_on.png"];
[b addListner:self selector:@selector(onPress:)];
[self addChild: b];
// PuruBtn.m
#import "PuruBtn.h"
@implementation PuruBtn
- (void)_init
{
[self schedule:@selector(tick:) interval: 1.0f];//初回は一秒後に実行
}
- (void)tick:(ccTime) dt
{
//プルプルさせる処理
-(void) _init;
-(void) _press;
-(void) _release;
PuyoBtn *b = [[PuyoBtn alloc] initWithFiles:@"b_border80.png" ro:@"b_border80_on.png"];
[b addListner:self selector:@selector(onPress:)];
[self addChild: b];
// PuyoBtn.m
#import "PuyoBtn.h"
@implementation PuyoBtn
enum{
kTagSequence,
};
- (void)_press
{
//release時のアクションを実行中の場合はキャンセルします
[self stopActionByTag:kTagSequence];
// PuyoBtn.h
#import "CCSpriteBtn.h"
@interface PuyoBtn : CCSpriteBtn{}
@end
-(id) init
{
if( (self=[super init])) {
//
CGSize stage = [[CCDirector sharedDirector] winSize];
//btn - ToggleBtn
CCSpriteBtn *b2 = [[CCSpriteBtn alloc] initToggleWithFiles:@"b_border80.png" toggle:@"b_border80_on.png"];
b2.Id = 2;
b2.position = ccp( b2.contentSize.width/2 , stage.height - b2.contentSize.height/2 - 98 );
-(id) init
{
if( (self=[super init])) {
//
CGSize stage = [[CCDirector sharedDirector] winSize];
//btn - onRelease
CCSpriteBtn *b1 = [[CCSpriteBtn alloc] initWithFiles:@"b_border80.png" ro:@"b_border80_on.png"];
b1.Id = 1;
b1.position = ccp( b1.contentSize.width/2 , stage.height - b1.contentSize.height/2 - 49 );
-(id) init
{
if( (self=[super init])) {
//
CGSize stage = [[CCDirector sharedDirector] winSize];
//btn - onPress
CCSpriteBtn *b0 = [[CCSpriteBtn alloc] initWithFiles:@"b_border80.png" ro:@"b_border80_on.png"];
b0.Id = 0;
b0.position = ccp( b0.contentSize.width/2 , stage.height - b0.contentSize.height/2 );