New answers tagged cocos2d-x
You can create a new Layer with an box and an CCMenu with one CCMenuItem. The CCMenuItem will be your OK Button where you will set your callback method. Something like... CCSprite *box = [CCSprite spriteWithFile:@"box.png"]; box.position = ccp(screen.width/2,screen.height/2); [self addChild:box]; CCMenuItemImage *okButton = ...
How did you get the idea that you could use CCSprite::create like that? the correct syntax would be: CCSprite::create(CCString::createWithFormat("sprite%d.png", rndSprtNum)->getCString()); Other than that your code seems to be fine, except I don't get what it's supposed to do, which is a little bit alerting. Seriously, did you even try compiling that ...
The easiest way would be to use the flood fill algorithm. In your specific case you will probably want to fire off two different flood fills, one to the right of Pacman and one to the left. Whichever one is suitable to fill (the smaller one, the one with no obstacles detected, etc.) is filled and the other is discarded.
Top 50 recent answers are included