1.4图片背景交替变换
float tt = 2.0f;
Sprite* splash = Sprite::create("splash_fall.png");
splash->setPosition(Vec2(480, 320));
this->addChild(splash);
splash->runAction(
RepeatForever::create(
Sequence::create(
FadeOut::create(tt),
DelayTime::create(tt),
CallFunc::create([splash](){splash->setTexture("splash_fall.png"); }),
FadeIn::create(tt),
DelayTime::create(tt),
FadeOut::create(tt),
DelayTime::create(tt),
CallFunc::create([splash](){splash->setTexture("splash_spring.png"); }),
FadeIn::create(tt),
DelayTime::create(tt),
nullptr
)));
Sprite* splash2 = Sprite::create("splash_summer.png");
splash2->setPosition(Vec2(480, 320));
splash2->setOpacity(0);
this->addChild(splash2);
splash2->runAction(
RepeatForever::create(
Sequence::create(
CallFunc::create([splash2](){splash2->setTexture("splash_summer.png"); }),
FadeIn::create(tt),
DelayTime::create(tt),
FadeOut::create(tt),
DelayTime::create(tt),
CallFunc::create([splash2](){splash2->setTexture("splash_winter.png"); }),
FadeIn::create(tt),
DelayTime::create(tt),
FadeOut::create(tt),
DelayTime::create(tt),
nullptr
)));
2.子弹降速
if (bullet->type == SHIT)
{
static float newspeed1 = bullet->target->speed * 0.8;
bullet->target->speed = newspeed1;
Sprite* bshit = Sprite::create("bullet/PShit-11.png");
bshit->setPosition(Vec2(30, 0));
bullet->target->addChild(bshit);
}