//散烟花及“太”“棒”“了”效果
void mygame::playfire() {
sprite *tai = sprite::create("tai.png");
tai->setposition(director::getinstance()->getvisiblesize().width *0.4, 540);
this->addchild(tai, 4);
actioninterval *forwardouttai = fadeout::create(2.0f); tai->runaction(forwardouttai);
sprite *bang = sprite::create("bang.png");
bang->setposition(director::getinstance()->getvisiblesize().width *0.6, 540);
this->addchild(bang, 4);
actioninterval *forwardoutbang = fadeout::create(2.0f);
bang->runaction(forwardoutbang);
sprite *le = sprite::create("le.png");
le->setposition(director::getinstance()->getvisiblesize().width *0.8, 540);
this->addchild(le, 4);
actioninterval *forwardoutle = fadeout::create(2.0f);
le->runaction(forwardoutle);
for (i = 1; i <= 3; i++) {
log("%s", "------------playfire");
auto explosion = particleexplosion::create();
explosion->settexture(director::getinstance()->gettexturecache()->addimage("fire.png"));
explosion->setposition(vec2(50 + i * 280, 440));
explosion->settotalparticles(300);
explosion->setlife(8.0f);
this->addchild(explosion, 5);
// 播放烟花声音
simpleaudioengine::getinstance()->preloadeffect("lose.mp3");
simpleaudioengine::getinstance()->playeffect("lose.mp3");
simpleaudioengine::getinstance()->setbackgroundmusicvolume(0.5);
}
}