本文整理汇总了C++中BackgroundLayer::stopMove方法的典型用法代码示例。如果您正苦于以下问题:C++ BackgroundLayer::stopMove方法的具体用法?C++ BackgroundLayer::stopMove怎么用?C++ BackgroundLayer::stopMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackgroundLayer
的用法示例。
在下文中一共展示了BackgroundLayer::stopMove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onContactBegin
bool HeroSprite::onContactBegin(PhysicsContact& contact) {
if (mState == STATE_DEAD) {
return false;
}
if (hitTest(contact, TAG_HERO_PHYS_BODY|TAG_GROUND1_PHYS_BODY)) {
Vec2 v = getPhysicsBody()->getVelocity();
getPhysicsBody()->setVelocity(Vec2(0, 0));
getPhysicsBody()->resetForces();
getPhysicsBody()->setContactTestBitmask(1<<1);
if ((mState == STATE_JUMP1)
|| (mState == STATE_JUMP2)
|| (mState == STATE_IDLE)) {
if (v.y < -200)
stand();
else
mState = STATE_STAND;
CallFunc *callback = CallFunc::create([&]() {
run();
});
auto delay = DelayTime::create(0.05f);
auto seq = Sequence::create(delay, callback, nullptr);
runAction(seq);
}
}
if (hitTest(contact, TAG_HERO_PHYS_BODY|TAG_BARRIER_PHYS_BODY)) {
BackgroundLayer * bg = (BackgroundLayer *)(getScene()
->getChildByName("gamelayer")
->getChildByName("background"));
bg->stopMove();
auto scale1 = ScaleTo::create(0.1, 0.9, 0.9);
auto scale2 = ScaleTo::create(0.1, 1.0, 1.0);
auto seq1 = Sequence::create(scale1, scale2, nullptr);
getNodeByTag(contact, TAG_BARRIER_PHYS_BODY)->runAction(seq1);
getPhysicsBody()->setContactTestBitmask(1<<1 | 1<<0);
dead();
CallFunc *callback = CallFunc::create([]() {
Director::getInstance()->replaceScene(GameOverScene::create());
});
auto seq = Sequence::create(DelayTime::create(1), callback, nullptr);
runAction(seq);
EventCustom event("EVENT_GameOver");
_eventDispatcher->dispatchEvent(&event);
}
return true;
}