void GameScene::checkMatch(Pix* pix) { if (_blockManager->isMatching(pix)) { ZUtils::playEffect(SOUND_MATCH); updateScore(); pix->runAction(Sequence::create(ScaleTo::create(0.5f, 1.5f), CallFuncN::create([this](Node* node){ auto p = (Pix*)node; p->setVisible(false); p->setPosition(10000, 10000); p->setScale(1.0f); }), NULL )); } else { ZUtils::playEffect(SOUND_FAIL); auto p = ParticleSystemQuad::create("explode.plist"); p->setPosition(pix->getPosition() + Vec2(0, 64)); p->setAutoRemoveOnFinish(true); this->addChild(p, kControl); pix->setPosition(10000, 10000); pix->setVisible(false); onLoose(); } }
void LocalDisplay::bind(AbstractPlayer *player){ GameDisplay::bind(player); connect(player, SIGNAL(onGone()), this, SLOT(onPlayerGone())); connect(player, SIGNAL(onLoose()), this, SLOT(onPlayerLoose())); connect(player, SIGNAL(onWin()), this, SLOT(onPlayerWon())); this->objectsUpdated(this->getPlayer()->getPosition()); }