void PlanLayer::setupViews(){ hero=CCSprite::createWithSpriteFrame(cache->spriteFrameByName("hero1.png")); hero->setContentSize(CCSize(50,55)); hero->setPosition(ccp(win_size.width/2,win_size.height/2-100)); this->addChild(hero,1); CCSpriteFrame* hero1=CCSpriteFrame::createWithTexture(pTexture2, CCRectMake(872, 73, 122, 100)); CCSpriteFrame* hero2=CCSpriteFrame::createWithTexture(pTexture2, CCRectMake(370, 55, 122, 100)); CCAnimation* animation=CCAnimation::create(); animation->setDelayPerUnit(0.05f); animation->addSpriteFrame(hero1); animation->addSpriteFrame(hero2); CCAnimate* animate=CCAnimate::create(animation); hero->setScale(0.5f); hero->setRotation(-90); hero->runAction(CCRepeatForever::create(animate)); CCLabelBMFont* score=CCLabelBMFont::create("00000", "font.fnt"); score->setAnchorPoint(ccp(0,1)); score->setScale(0.7f); score->setPosition(40,win_size.height-8); this->addChild(score,3,30); addEnmy(); addBullets(); scheduleUpdate(); schedule(schedule_selector(PlanLayer::releaseBullets), 0.2f); schedule(schedule_selector(PlanLayer::enemyMove), 0.02f); }
static void move() { switch ( status ) { case TITLE: moveTitleMenu(); moveBackground(); addBullets(); moveFoes(); break; case IN_GAME: moveBackground(); addBullets(); moveShots(); moveShip(); moveFoes(); moveFrags(); moveBonuses(); break; case GAMEOVER: moveGameover(); moveBackground(); addBullets(); moveShots(); moveFoes(); moveFrags(); break; case STAGE_CLEAR: moveStageClear(); moveBackground(); moveShots(); moveShip(); moveFrags(); moveBonuses(); break; case PAUSE: movePause(); break; } }