PSprite_leaf2->runAction(CCRepeatForever::create((CCActionInterval*)(CCSequence::create(sleep_rotate_2,rotateAction1, rotateAction2,rotateAction1, rotateAction2,sleep_rotate_2, NULL)))) ĬCSprite* pSprite_Island = CCSprite::create("island.png") PSprite_leaf2->setPosition( ccpAdd(VisibleRect::center(), ccp(pSprite_leaf1->getContentSize().width,pSprite_leaf1->getContentSize().height/2*3)) ) PSprite_leaf1->runAction(CCRepeatForever::create((CCActionInterval*)(CCSequence::create(rotateAction1, rotateAction2,rotateAction1, rotateAction2,sleep_rotate, NULL)))) ĬCSprite* pSprite_leaf2 = CCSprite::createWithSpriteFrameName("leaf2.png") PSprite_leaf1->setAnchorPoint(ccp(0.5f,0.0f)) //设置锚点为中下点ĬCActionInterval* rotateAction1 = CCRotateBy::create(0.1f,25.0f) ĬCActionInterval* rotateAction2 = CCRotateTo::create(0.1f, -25.0f) ĬCDelayTime* sleep_rotate = CCDelayTime::create(4.0f) PSprite_leaf1->setPosition( ccpAdd(VisibleRect::center(), ccp(0,pSprite_leaf1->getContentSize().height/2*3)) ) PSprite->setPosition(VisibleRect::center()) ĬCSprite* pSprite_leaf1 = CCSprite::createWithSpriteFrameName("leaf1.png") PLabel->setPosition(ccpAdd(VisibleRect::top(),ccp(0, -pLabel->getContentSize().height))) ĬCSpriteFrameCache *cache = CCSpriteFrameCache::sharedSpriteFrameCache() Ĭache->addSpriteFramesWithFile("main_ist", "main_menu.png") ĬCSprite* pSprite = CCSprite::create("bg.jpg") PCloseItem->setPosition(ccpAdd(VisibleRect::rightBottom(),Ĭcp(-pCloseItem->getContentSize().width/2, pCloseItem->getContentSize().height/2))) ĬCMenu* pMenu = CCMenu::create(pCloseItem, NULL) ĬCLabelTTF* pLabel = CCLabelTTF::create("hello cocos2d-x", "Arial", SCALE_FACTOR * 36 ) Menu_selector(HelloWorld::menuCloseCallback)) *CCMenuItemImage *pCloseItem = CCMenuItemImage::create( *CCLog(" SCALE_FACTOR ->%f ", SCALE_FACTOR) */ on "init" you need to initialize your instance GameRoot::shareGameRoot()->sethasStart(false) This->schedule(schedule_selector(GameHud::countDown), 1.0f) TimerLab->setPosition(ccp(winsize.width/2, winsize.height/2)) TimerLab = CCLabelTTF::create("5", "Arial-BoldMT", 50) This, menu_selector(GameHud::click_attack)) ĬCMenu* menu1 = CCMenu::createWithItem(btn_attack) Menu0->setPosition( winsize.width-200, 40) ĬCMenuItemSprite* btn_attack = CCMenuItemSprite::create(ĬCSprite::createWithSpriteFrameName("btn_soldierattack1.png"),ĬCSprite::createWithSpriteFrameName("btn_soldierattack2.png"), SelectFlag->setPosition( ccpAdd(item1->getPosition(), menu->getPosition())) ĬCLabelTTF* lab = CCLabelTTF::create("所需 100 援兵", "Arial-BoldMT", 20) ĬCMenuItemFont *add = CCMenuItemFont::create("增援", this, menu_selector(GameHud::click_addSoldier)) ĬCMenu *menu0 = CCMenu::createWithItem(add) SelectFlag = CCSprite::create("aim.png") pstroke = createStroke(pLabelTTF, 1, kFontSystem.strokeColor) ĬCSize winsize = CCDirector::sharedDirector()->getWinSize() ĬCSprite* background = CCSprite::create("hud.png") įloat saclex = winsize.width/background->boundingBox().size.width ĬCMenuItemSprite * item1 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A1_0.png"), CCSprite::createWithSpriteFrameName("A1_0.png"), this, menu_selector(GameHud::soldier1_Select)) ĬCMenuItemSprite * item2 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A2_0.png"), CCSprite::createWithSpriteFrameName("A2_0.png"), this, menu_selector(GameHud::soldier2_Select)) ĬCMenuItemSprite * item3 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A3_0.png"), CCSprite::createWithSpriteFrameName("A3_0.png"), this, menu_selector(GameHud::soldier3_Select)) ĬCMenuItemSprite * item4 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A4_0.png"), CCSprite::createWithSpriteFrameName("A4_0.png"), this, menu_selector(GameHud::soldier4_Select)) ĬCMenu* menu = CCMenu::create(item1,item2,item3,item4,NULL) pLabelTTF->setPosition( pNode->getPosition() ) pLabelTTF = CCLabelTTF::labelWithString( m_TitleBuffer, kFontSystem.fontName, kFontSystem.fontSize ) pNode = GetXMLNodeFromKey( "t2dSceneObject_tipname" ) PLabelTTF->setPosition( pNode->getPosition() ) PLabelTTF->setPosition( pMenu->getPosition() ) ĬCRenderTexture* pstroke = createStroke(pLabelTTF, 1, kFontSystem.strokeColor) ĬCNode *pNode = GetXMLNodeFromKey( "t2dSceneObject_Message" ) ĬCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( m_szBuffer, kFontSystem.fontName, kFontSystem.fontSize ) -Ĭonst char *MenuButton = ĬCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( YesNo, kFontSystem.fontName, kFontSystem.fontSize )
0 Comments
Leave a Reply. |