Monday, 15 August 2011

ios - Initializing a child CCNode onto a parent CCNode -



ios - Initializing a child CCNode onto a parent CCNode -

i working spritebuilder , cocos2d build simple game, , want display error message within if statement.

my problem trying initialize ccnode created in spritebuilder show on-screen.

i tried creating ccnode layer , creating objects via spritebuilder, wasn't sure how supposed show on-screen tried did not work correctly. tried using [self addchild:errorlayer] in if statement , crashed app error message argument must non-nil, set breakpoint , errorlayer nil, i'm not sure how create non-nil.

i tried creating ccnode programmatically, when if-statement run didn't display on-screen. here code tried:

ccnode *errorlayer = [[ccnode alloc] init]; [errorlayer setcontentsize:cgsizemake(50, 100)]; [errorlayer setcolor:[cccolor redcolor]]; [self addchild:errorlayer];

could give me tips on getting work? thanks.

mainscene, scene above code called in, initialized in appcontroller this

- (ccscene*) startscene { homecoming [ccbreader loadasscene:@"mainscene"]; }

ios xcode cocos2d-iphone spritebuilder ccnode

No comments:

Post a Comment