-(id) init { if ((self=[super init]) ) { CCSprite *hoge = [CCSprite spriteWithFile:@"hoge.png"]; hoge.tag = 13; [self addChild:hoge]; //hogeの子要素 CCSprite *sub = [CCSprite spriteWithFile:@"sub.png"]; [hoge addChild:sub]; } } - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CCSprite *hoge = (CCSprite*)[self getChildByTag:13]; //hogeとsubの両方縮小される hoge.scale = 0.5; return YES; }
0 件のコメント:
コメントを投稿