![]() create menu, it's an autorelease objectĬCMenu* pMenu = CCMenu::create(pCloseItem, NULL) ĬCLabelTTF* pLabel = CCLabelTTF::create("Colorful Touch-x", "Hevetica-BoldOblique", 100) ĬCSize size = CCDirector::sharedDirector()->getWinSize() ![]() PCloseItem->setPosition( ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20) ) Menu_selector(HelloWorld::menuCloseCallback) ) it's an autorelease objectĬCMenuItemImage *pCloseItem = CCMenuItemImage::create( add a "close" icon to exit the progress. add a menu item with "X" image, which is clicked to quit the program on "init" you need to initialize your instance This->addChild(menu,kZOrderScore,kTagMenu) ĬCFiniteTimeAction* initFade = CCFadeTo::create(0.0f,0) ĬCFiniteTimeAction* initMove = CCMoveTo::create(0.0f,ccp(m_winSize.width / 2,50.0f - 10.0f)) ĬCSequence* initMix = CCSequence::createWithTwoActions(initFade,initMove) ĬCFiniteTimeAction* fade = CCFadeIn::create(1.5f) ĬCFiniteTimeAction* move = CCMoveBy::create(1.5f,ccp(0,10.0f)) ĬCSpawn* mix = CCSpawn::createWithTwoActions(fade,move) ĬCActionInterval* easeMix = CCEaseIn::create( CCSequence::createWithTwoActions(initMix,mix), 2.0f) menu->setPosition(ccp(m_winSize.width / 2,m_winSize.height/ 4 - 10)) menu->setPosition(ccp(m_winSize.width / 2,m_winSize.height * 1.2)) Menu->alignItemsHorizontallyWithPadding( 30.0f) "ButtonTitle.png","ButtonTitle.png", this, menu_selector(GameScene::tapTitleButton)) ĬCMenu* menu = CCMenu::create(retryButton, wallButton, titleButton, NULL) "ButtonWall.png", "ButtonWall.png", this, menu_selector(GameScene::tapWallButton)) ĬCMenuItemImage* titleButton = CCMenuItemImage::create( ![]() "ButtonRetry.png","ButtonRetry.png", this, menu_selector(GameScene::tapRetryButton)) ĬCMenuItemImage* wallButton = CCMenuItemImage::create( Create and run an animation that will slide the start game menu in from below the screen to its intended locationĬCActionInterval *moveAction = CCMoveTo::create(0.3f, ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT*0.15)) ĬCFiniteTimeAction *easeIn = CCEaseIn::create(moveAction, 0.2f) ĬCMenuItemImage* retryButton = CCMenuItemImage::create( GameMenu->setTag(kGameOverLayer_PlayAgainMenu) Set the tag of the start menu so that we can refer to it later using getChildByTag(.) GameMenu->setPosition(ccp(SCREEN_WIDTH/2, -SCREEN_HEIGHT)) MainButton->setPositionX(mainButton->getContentSize().width/1.2) ĬCMenu *gameMenu = CCMenu::create(playAgainButton, mainButton, NULL) PlayAgainButton->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.0f, 1.2f), CCScaleTo::create(1.0f, 1.0f)))) ĬCSprite *mainButtonSpriteUp = CCSprite::createWithSpriteFrameName("main_button.png") ĬCSprite *mainButtonSpriteDown = CCSprite::createWithSpriteFrameName("main_button.png") ĬCMenuItemSprite *mainButton = CCMenuItemSprite::create(mainButtonSpriteUp, mainButtonSpriteDown, this, menu_selector(GameOverLayer::mainButtonTouched)) PlayAgainButtonSpriteDown->setScale(0.9f) ĬCMenuItemSprite *playAgainButton = CCMenuItemSprite::create(playAgainButtonSpriteUp, playAgainButtonSpriteDown, this, menu_selector(GameOverLayer::playAgainButtonTouched)) ![]() Scale the down to 90% so that it looks like the button was pressed Void GameOverLayer::createPlayAgainButton()ĬCSprite *playAgainButtonSpriteUp = CCSprite::createWithSpriteFrameName("playagain_button.png") ĬCSprite *playAgainButtonSpriteDown = CCSprite::createWithSpriteFrameName("playagain_button.png") ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |