COLL_RET TankAILife3::onCollision(cocos2d::Node* other) { if (other->getTag() == COLL_BULLET || other->getTag() == COLL_BULLET_IRON) { if (3 == _life) { _twoLifeSprite = Sprite::createWithSpriteFrameName("tank_life3_2.png"); _twoLifeSprite->setScale(_scale); this->setTexture(_twoLifeSprite->getTexture()); this->addChild(_twoLifeSprite); --_life; if (!_isSleeping) { scheduleOnce(schedule_selector(TankAILife3::resumeLife), 3.0f); } return RETAIN; }else if (2 == _life) { _oneLifeSprite = Sprite::createWithSpriteFrameName("tank_life3_1.png"); _oneLifeSprite->setScale(_scale); this->setTexture(_oneLifeSprite->getTexture()); this->addChild(_oneLifeSprite); --_life; if (!_isSleeping) { scheduleOnce(schedule_selector(TankAILife3::resumeLife2), 3.0f); } return RETAIN; } } return TankAI::onCollision(other); }
void HelloWorld::ScoreSchedule(float dt) { //ShowNumberNode * snn = ShowNumberNode::CreateShowNumberNode("menu_num_white.png", 923, 9/mfac, 18/mfac ); //float xpos=m_pScore->boundingBox().getMaxX()-m_pScore->boundingBox().getMinX()-45; //float ypos=m_pScore->boundingBox().getMaxY()-m_pScore->boundingBox().getMinY()-45; if (++myscore<= testnum) { msnn->f_ShowNumber(myscore); } else { scheduleOnce(schedule_selector(HelloWorld::MoveStart), 0.5); scheduleOnce(schedule_selector(HelloWorld::MoveTop), 0.5); unschedule(schedule_selector(HelloWorld::ScoreSchedule)); scheduleOnce(schedule_selector(HelloWorld::addShare), 1); //m_pStart->setVisible(true); //m_pTop->setVisible(true); } //snn->setPosition(ccp(xpos,ypos)); //m_pScore->addChild(snn,5,0); //schedule(schedule_selector(HelloWorld::logic), 2.0f); }
void Battle::playActionOver(cocostudio::Armature *armature, cocostudio::MovementEventType type, const char *name) { if (armature == m_pReadygo) { if (type == COMPLETE) { removeChild(armature); m_pReadygo = NULL; unmask(); BIND(BUND_ID_GLOBAL_TOUCH_MOVED, this, Battle::globalTouchMoved); g_pEventEngine->BundlerCall(BUND_ID_PLANE_FIRE, this, sizeof(this)); } } if (armature == m_pBossIn) { if (type == COMPLETE) { removeChild(armature); m_pBossIn = NULL; unmask(); const BossConfig * pconfig = g_pGameConfig->getBossConfig(m_pConfig->boss); m_pBoss = Boss::create(pconfig); addChild(m_pBoss, GRADE_ENEMY); if (m_pConfig->boss != "chisezhilang") { m_pBoss->setScale(g_pGameConfig->scaleEleMin); } else { m_pBoss->setScale(g_pGameConfig->scaleEleMin * 1.5); } m_pBoss->setPosition(Vec2(pconfig->pos.x * g_pGameConfig->scaleEleX, pconfig->pos.y * g_pGameConfig->scaleEleY)); m_pBoss->setRotation(pconfig->rotate); ActionInterval * action = MoveBy::create(2, Vec2(0, -500 * g_pGameConfig->scaleEleY)); m_pBoss->runAction(Sequence::create(action, CallFuncN::create(this, callfuncN_selector(Battle::playbossAi)), NULL)); } } if (armature == m_pMissionVictory) { if (type == COMPLETE) { Node * icon = g_pGameConfig->getIcon(m_equip.model, m_equip.type); icon->setPosition(Vec2(-200, -275)); icon->setScale(g_pGameConfig->scaleEleMin * 5); m_pMissionVictory->addChild(icon, GRADE_UI); icon->setOpacity(0); ActionInterval * scale = ScaleTo::create(.5f, g_pGameConfig->scaleEleMin * 1.5); ActionInterval * fadein = FadeIn::create(.5f); icon->runAction(Spawn::create(scale, fadein, NULL)); UNBIND(BUND_ID_GLOBAL_TOUCH_MOVED, this, Battle::globalTouchMoved); scheduleOnce(schedule_selector(Battle::returnMission), 2.0f); } } if (armature == m_pMissionFaild) { if (type == COMPLETE) { UNBIND(BUND_ID_GLOBAL_TOUCH_MOVED, this, Battle::globalTouchMoved); scheduleOnce(schedule_selector(Battle::returnMission), 2.0f); } } }
void Battle::OnHttpRes(const s32 id, const Json::Value * root, const void * context, const s32 size) { switch (id) { case HTTP_REQUEST_ID_COUNT_PVE: { if (NULL == root) { ALERT("请检查你的网络连接"); return; } if ((*root)["code"] == ERROR_CODE::ERROR_CODE_NO_ERROR) { m_equip.id = StringAsInt((*root)["data"]["equipid"].asString().c_str()); m_equip.isequiped = StringAsInt((*root)["data"]["status"].asString().c_str()); m_equip.type = (*root)["data"]["type"].asInt(); m_equip.model = (*root)["data"]["modelname"].asString(); m_equip.exp = (*root)["data"]["exp"].asInt(); m_equip.level = (*root)["data"]["level"].asInt(); g_pEquipManager->saveEquip(m_equip); scheduleOnce(schedule_selector(Battle::pve_vector), 2.0f); } else { ALERT("小火鸡,不要作弊,小心被封号"); } break; } default: break; } }
void UtilManager::toast(string text, CAViewController* object) { CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG); CCSize winSize = CAApplication::getApplication()->getWinSize(); //CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3)); CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, 180 * getScale(), 30 * getScale())); back->setTag(TOAST_VIEW_TAG); back->setColor(ccc4(31, 31, 31, 200));//40 CALabel *title = CALabel::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.5), 180 * getScale(), 30 * getScale())); // title->setText(UTF8ToGBK::transferToGbk(text)); title->setText(text); //title->setText("sssss"); // title->setFontName(getChineseFont()); title->setColor(CAColor_white); title->setTextAlignment(CATextAlignmentCenter); title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter); title->setFontSize(_px(15)); back->addSubview(title); //CAApplication::getApplication()->getRootWindow()->getRootViewController()->getView()->addSubview(back); back->runAction(CCFadeOut::create(1)); //CAApplication::getApplication()->getRootWindow()->addSubview(back); object->getView()->addSubview(back); //CCLog("%s", get_date_now().c_str()); scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME); }
void OptionScene::goOut(Widget* layout, Widget* widget, Widget* newWidget) { layout->setEnabled(false); newWidget->setEnabled(false); auto buttonCenter = layout->convertToNodeSpace(widget->getWorldPosition()); auto layoutSize = layout->getContentSize(); auto buttonSize = widget->getContentSize(); layout->setAnchorPoint(Vec2(buttonCenter.x / layoutSize.width, buttonCenter.y / layoutSize.height)); layout->setPosition(buttonCenter); auto moveAction = MoveTo::create(goIntoOutTime, buttonCenter); layout->runAction(moveAction); auto scaleAction = ScaleTo::create(goIntoOutTime, 1.0f); layout->runAction(scaleAction); auto fadeInAaction = FadeIn::create(goIntoOutTime); widget->runAction(fadeInAaction); int sacle; if (buttonSize.width > buttonSize.height) { sacle = this->getContentSize().height / buttonSize.height; } else { sacle = this->getContentSize().width / buttonSize.width; } auto newScaleAction = ScaleTo::create(goIntoOutTime, 1 / sacle); newWidget->runAction(newScaleAction); newWidget->runAction(moveAction->clone()); auto fadeOutAaction = FadeOut::create(goIntoOutTime); newWidget->runAction(fadeOutAaction); scheduleOnce([this, newWidget, layout](float) { this->removeChild(newWidget); layout->setEnabled(true); }, goIntoOutTime, "goOut"); }
void ScoreText::initWithScore(int score, Point pos, Color3B col) { setPosition(pos); Label* label = Label::createWithBMFont(MATH_FNT, "+" + nToString(score));//, NORMAL_TTF, 46.0f); //label->setScale(1.1f); label->setHorizontalAlignment(TextHAlignment::CENTER); addChild(label); label->setOpacity(0); label->runAction(Sequence::create( FadeIn::create(0.3f), DelayTime::create(0.8f), FadeOut::create(0.3f), NULL)); /* col.r *= 0.5; col.g *= 0.5; col.b *= 0.5;*/ label->setColor(Color3B::WHITE); label->disableEffect(); label->runAction(TintTo::create(1.0f, col.r, col.g, col.b)); label->runAction(MoveBy::create(1.0f, Point(0, PY(0.05f)))); //label->enableGlow(Color4B(col)); //label->enableShadow(); scheduleOnce(schedule_selector(ScoreText::collect), 3.0f); }
// on "init" you need to initialize your instance bool Welcome::init() { ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); cocos2d::Vec2 origin = Director::getInstance()->getVisibleOrigin(); auto label = LabelTTF::create("meijia", "Arial", 80); // position the label on the center of the screen label->setPosition(cocos2d::Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height/4*3)); // add the label as a child to this layer //this->addChild(label, 1); // add "HelloWorld" splash screen" auto sprite = Sprite::create("WelcomeBg.png"); // sprite->addChild(label, 1); // position the sprite on the center of the screen sprite->setPosition(cocos2d::Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); scheduleOnce(schedule_selector(Welcome::transToMeijia), 1.f); return true; }
void SGSHero::onDelay(SGMessage* message) { float time; message->getFloat("time", &time); unscheduleUpdate(); scheduleOnce(schedule_selector(SGSHero::startUpdate), time); }
bool ScatOrcScene::init() { assert(TRBaseScene::init()); _layer = Layer::create(); this->addChild(_layer); auto sp2 = Sprite::create("images/white.png"); sp2->setScale(500); _layer->addChild(sp2); auto sp = Sprite::create("images/scatorc.png"); sp->setPosition(genPos({0.5,0.5})); _layer->addChild(sp); auto size = Director::getInstance()->getWinSize(); // sp->setScale(size.width/sp->getContentSize().width, size.height/sp->getContentSize().height); sp->setOpacity(0); sp->runAction(Sequence::create(FadeIn::create(0.1), DelayTime::create(0.1), FadeOut::create(0.1), nullptr)); scheduleOnce([this](float dt){ Director::getInstance()->replaceScene(WelcomeScene::create()); }, 0.4, "gamescene open"); return true; }
//do initialization here void LCBattleScene::initView() { backGround = Sprite::create("BackGround.png"); //backGround->setScale(3); this->addChild(backGround); Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstance()->getVisibleOrigin(); backGround->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); lifeObj::setActiveRange(backGround->getContentSize()); lifeObj::setMap(backGround); createHero(); addMonster(3); hero->objList = monsterArr; __NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(LCBattleScene::delteMonster), "delteMonster", NULL); schedule(schedule_selector(LCBattleScene::followHero), 3.0f, -1, 1); scheduleOnce(schedule_selector(LCBattleScene::test), 1); scheduleUpdate(); // schedule(, 2, 2); }
bool LoadingLayer::init() { if (!CCLayer::init()) return false; //窗口大小 CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); //当前层的位置 CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); CCLayerColor* layercolor = CCLayerColor::create(ccc4(255,255,255,255),800,480) ; addChild(layercolor) ; // // ui = TouchGroup::create(); // // ui->addWidget(GUIReader::shareReader()->widgetFromJsonFile("UI/GameMainMenu_1/loadingLayer.ExportJson")); // //ui->setVisible(false); // addChild(ui, 2); //hideDot(); num = 0; CCSprite * logo = CCSprite::create("logo.png"); logo->setPosition(ccp(visibleSize.width/2,visibleSize.height/2)); this->addChild(logo,1000); //schedule(schedule_selector(LoadingLayer::showDot),0.1); logo->setScale(2.5); scheduleOnce(schedule_selector(LoadingLayer::loading),0.1); return true; }
void LoadingLayer::onEnterTransitionDidFinish(){ // KKAds ads; // ads.setAdsVisibility(false); LayerColor::onEnterTransitionDidFinish(); runAnimation(); scheduleOnce(schedule_selector(LoadingLayer::updateToMainScene), 2.5f); }
bool FieldScene::init() { if (!LayerColor::initWithColor(Color4B(255, 255, 255, 255))) { return false; } // 필드레이어 this->setFieldLayer( FieldLayer::create()); this->getFieldLayer()->setPosition(90, 10); this->addChild(this->getFieldLayer(),1); // 화면 틀 레이어 this->setFrameLayer(FrameLayer::create()); this->getFrameLayer()->setPosition(0, 0); this->addChild(this->getFrameLayer(),2); // 메뉴 레이어 띄우기 this->m_menuLayer = MenuLayer::create(); this->m_menuLayer->setPosition(0, 0); this->addChild(m_menuLayer, 3); // 테스트용 몬스터 등장용 scheduleOnce(schedule_selector(FieldScene::Battle), 3.0f); return true; }
void GameWorld::OnCollision(b2Vec2 contact_normal) { // ignore collisions when the clown is in these states switch(clown_->GetState()) { case E_CLOWN_UP: case E_CLOWN_ROCKET: case E_CLOWN_BALLOON: return; } // stop the clown's movement clown_->GetBody()->SetLinearVelocity(b2Vec2_zero); // update the clown's state clown_->SetState(E_CLOWN_BOUNCE); // save the normal at the point of contact contact_normal_ = contact_normal; // animate the platform platform_->runAction(CCSequence::createWithTwoActions(CCAnimate::create(CCAnimationCache::sharedAnimationCache()->animationByName("platform_animation")), CCHide::create())); // schedule the actual collision response after a short duration scheduleOnce(schedule_selector(GameWorld::DoCollisionResponse), 0.15f); has_game_begun_ = true; SOUND_ENGINE->playEffect("platform.wav"); }
void TipsScene::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) { //松开屏幕 float x = pTouch->getLocation().x; float y = pTouch -> getLocation().y; if (!isAutoRemove) { if (isHasTarget) { if (ccpDistance(targetPoint,ccp(x,y)) < targetRidus || istouchRemove) { BattleManage* pauseLayer = BattleManage::oneself; pauseLayer -> resumeSchedulerAndActions(); runCallBack(); scheduleOnce(schedule_selector(TipsScene::scheduleRemove),0.05); } } else { BattleManage* pauseLayer = BattleManage::oneself; pauseLayer -> pauseSchedulerAndActions(); this -> removeFromParent(); } } }
void LoadingScene::GotoNextScene() { //goto next scene. SpriteFrameCache::getInstance()->addSpriteFramesWithFile("gameover.plist","gameover.png"); scheduleOnce(schedule_selector(LoadingScene::RunNextScene), 1.0f); }
void Hero::handBlade() { if (inTheAir_flag) { if (getMode() == LIGHTBLADE) { setMode(SHIELD); } else setMode(LIGHTBLADE); } else { if (getMode() == LIGHTBLADE) { m_sprite->getAnimation()->play("Stand"); setMode(SHIELD); } else { setState(FORCED); m_sprite->getAnimation()->playByIndex(13); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Audio/haaaaa.ogg"); scheduleOnce(schedule_selector(Hero::afterHandBlade),1.0f); } } }
void EndlessScene::manualAct2() { Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); auto manual_mask = Sprite::create("manual/mask.png"); manual_mask->setPosition(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2); this->addChild(manual_mask, 5, "manual_mask"); CCSprite* target_frame = CCSprite::create("manual/redFrame.png"); target_frame->setPosition(origin.x + 190, origin.y + visibleSize.height / 2); target_frame->setScale(1.1, 1.0); this->addChild(target_frame, 5, "target_frame"); CCSprite* endless_tip1 = CCSprite::create("manual/endlessTip1.png"); endless_tip1->setPosition(origin.x + visibleSize.width / 2 - 50, origin.y + visibleSize.height - 300); this->addChild(endless_tip1, 5, "endlesstip1"); CCSprite* endless_tip2 = CCSprite::create("manual/endlessTip2.png"); endless_tip2->setPosition(origin.x + visibleSize.width / 2 + 100, origin.y + visibleSize.height / 2); this->addChild(endless_tip2, 5, "endlesstip2"); scheduleOnce(schedule_selector(EndlessScene::updateManualAct1), 1.0f); }
void Item::itemTouchEnded() { isInTouch=false; isInMove=false; if ( !afterLongPress &&(millisecondNow()-touchBeginTime)<200) { this->unschedule(schedule_selector(Item::checkLongPress)); if ( m_bClicked ) { m_bClicked = false; this->doubleClickSprite(); } else { scheduleOnce(schedule_selector(Item::singleClickSprite), 0.2f); m_bClicked = true; return; } } // 恢复 精灵 // this->setScale(1); // // this->setPosition(orignalPoint); // // this->setOpacity(255); }
void GameLotteryLayer::onCircleStop() { SoundPlayer::stopAllSounds(); enableBtns(); // result Go button if (m_bIsLotteryNormally) { m_bIsLotteryNormally = false; SoundPlayer::play(SNDI_SLOT_RESULT); // remove old highlight CCNode* ptrLight = m_ptrCircle->getChildByTag(LIGHT_TAG); if(ptrLight) { ptrLight->removeFromParent(); ptrLight = NULL; } // create highlight ptrLight = CREATE_SPRITE(this, "lottery_selected_game.png", true); ptrLight->setTag(LIGHT_TAG); ptrLight->setRotation(CircleHeightLightRotation[m_iCurLottery]); m_ptrCircle->addChild(ptrLight); ptrLight->setPosition(CircleHeightLightPositionX[m_iCurLottery], CircleHeightLightPositionY[m_iCurLottery]); disableBtns(); setGoResult(WIN_CHIPS); animateToShowHint(); scheduleOnce(schedule_selector(GameLotteryLayer::removeHint), 5.0f); } // reset buttons //initBtnGo(); //chargeNewDay(); }
void CCCGameScrollView::scrollToPage( int nPage ) { // 关闭CCScrollView中的自调整 unscheduleAllSelectors(); CCPoint oOffset = getContentOffset(); // 调整位置 CCPoint adjustPos; if (m_eDirection == kCCScrollViewDirectionHorizontal) { adjustPos = ccp(-m_CellSize.width * nPage, 0); } else { adjustPos = ccp(0, m_CellSize.height * nPage); } // 调整动画时间 float adjustAnimDelay = ccpDistance(adjustPos, oOffset) / m_fAdjustSpeed; // 调整位置 setContentOffsetInDuration(adjustPos, adjustAnimDelay); if (nPage != m_nCurPage) { m_nCurPage = nPage; scheduleOnce(schedule_selector(CCCGameScrollView::onScrollEnd), adjustAnimDelay); } }
void AchievementNotification::onEnter() { LFLayer::onEnter(); //CCLog("AchievementNotification::onEnter ----- "); scheduleOnce(schedule_selector(AchievementNotification::startMonitoring),1.0f); }
bool MissionBrief::init(const std::string& i_campaign) { if(!cocos2d::Scene::init()) return false; cocos2d::UserDefault::getInstance()->setIntegerForKey("CurrentLevel", level); auto sz = cocos2d::Director::getInstance()->getVisibleSize(); auto* background = cocos2d::Layer::create(); CampaignReader reader(RES("base",i_campaign)); const CampaignReader::Mission& mission = reader.getMission(level); auto label = cocos2d::Label::createWithTTF("Уровень "+std::to_string(level+1)+"\n"+mission.missionName, RES("fonts","Washington.ttf"), 120); label->setAlignment(cocos2d::TextHAlignment::CENTER); label->setPosition(sz.width/2, sz.height/2); background->addChild(label); addChild(background); scheduleOnce([&, mission](float d) { auto scene = HelloWorld::createScene(mission); cocos2d::Director::getInstance()->replaceScene(cocos2d::TransitionFade::create(5, scene)); }, 5, "key?"); return true; }
void gameLevel2::createThirdEnemy() { auto _enemyLayer = new EnemyLayer(); auto enemyLayer = _enemyLayer->create(Vec2(origin.x + visibleSize.width + enemy->getContentSize().width, origin.y + visibleSize.height - visibleSize.height / 4), soundState); enemyLayer->setPosition(Vec2(0, 0)); this->addChild(enemyLayer, 2); if (visibleSize.width < visibleSize.height) enemyLayer->setScale(1.2); enemy = _enemyLayer->getShip(); auto top = MoveTo::create(1, Vec2(enemy->getPositionX(), origin.y + visibleSize.height - visibleSize.height / 4)); enemy->runAction(top); enemyScore = 250; isEnemyReady = true; scheduleOnce(schedule_selector(gameLevel2::lastEnemyMovement), 1); }
void EnemyBulletLayer::update(float useless) { Animation* animationExplosion = AnimationCache::getInstance()->getAnimation("explosion"); animationExplosion->setRestoreOriginalFrame(false); animationExplosion->setDelayPerUnit(0.5f / 9.0f); actionExplosion = Animate::create(animationExplosion); Sprite* myPlane = static_cast<GameScene*>(this->getParent())->getPlaneLayer()->getMyPlane(); for (Sprite* bullet : this->allEnemyBullet) { if (bullet->getBoundingBox().intersectsRect(myPlane->getBoundingBox())) { if(static_cast<PlaneUserData*>(myPlane->getUserData())->isAliveUnderAttack(200) == false){ //更新HP指示器 static_cast<GameScene*>(this->getParent())->getControlLayer()->updateHPIndicator(); static_cast<GameScene*>(this->getParent())->getBulletLayer()->stopShooting(); myPlane->runAction(Sequence::create(actionExplosion, NULL)); this->bossStopShooting(); scheduleOnce(schedule_selector(EnemyBulletLayer::changeSceneCallBack), 1.0f); return; }else{ //更新HP指示器 static_cast<GameScene*>(this->getParent())->getControlLayer()->updateHPIndicator(); } bossBulletMoveFinished(bullet); break; } } }
void ChatLayer::showChatContext(float delta) { CCSize winSize = CCDirector::sharedDirector()->getWinSize(); int idx = m_index-1; string speakStr = getFileByName(m_chatContext.at(idx).name).first + ":"; string chatStr(m_chatContext.at(idx).chatStr); CCLabelTTF *nameLabel = ((CCLabelTTF*)getChildByTag(Tag_Label_Name)); CCLabelTTF * label = ((CCLabelTTF*)getChildByTag(TAG_label)); nameLabel->setString(speakStr.c_str()); label->setString(chatStr.c_str()); nameLabel->setOpacity(0); label->setOpacity(0); nameLabel->runAction(CCSequence::create( CCFadeTo::create(0.25f, 255) , NULL)); label->runAction(CCSequence::create( CCFadeTo::create(0.25f, 255) , CCCallFunc::create(this, callfunc_selector(ChatLayer::labelFadeInEnd)) , NULL)); if (m_chatContext.at(idx).deltaTime > 0.1f) { mCurMusicId = Music::sharedMusicPlayer()->playEffectSound(m_chatContext.at(idx).musicFile); scheduleOnce(schedule_selector(ChatLayer::saidChatContextEnd), m_chatContext.at(idx).deltaTime + delta_time);//有的时间太短。、、 } }
void Plane::setSpecialBullet(BulletType type) { if (m_bulletType == DOUBLE_BULLET) { unschedule(schedule_selector(Plane::clearDouble)); } m_bulletType = type; scheduleOnce(schedule_selector(Plane::clearDouble), 15.0f); }
bool Splash::init(){ if(!Layer::init()) return false; auto sprite = Sprite::create("Splash.png"); addChild(sprite); sprite->ignoreAnchorPointForPosition(true); scheduleOnce(schedule_selector(Splash::updateOnce), 1.2f); return true; }
void SnakeLayer::spawnBonus() { Sprite* item = MAKESPRITE("lolli"); item->setPosition(VCP(RANDF*0.9f + 0.05f, RANDF*0.7f + 0.15f)); item->setScale(0.85f); bonusGroup->addChild(item); scheduleOnce(schedule_selector(SnakeLayer::removeBonus), 6.0f); }