本文整理汇总了C++中Fish::SetSlidslipSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ Fish::SetSlidslipSpeed方法的具体用法?C++ Fish::SetSlidslipSpeed怎么用?C++ Fish::SetSlidslipSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fish
的用法示例。
在下文中一共展示了Fish::SetSlidslipSpeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XMTMoveAI
//.........这里部分代码省略.........
for(auto a : children)
{
if((a->getTag() & OBJ_FISH) == OBJ_FISH)
{
Fish* fish = (Fish*)a;
Rect fRect = fish->getBoundingBox();
if(fRect.intersectsRect(pRect))
{
if(fish->GetLevel() > player->GetLevel())
{
// game over
gData->_healthPoint = 0;
JizGame::getInstance()->playAudioEffect("audioeffect/hurt2.mp3");
}
else
{
JizGame::getInstance()->playAudioEffect("audioeffect/eat1.mp3");
gData->_experience += (10 + fish->GetLevel());
gData->_eatedCount++;
gData->_staminaPoint += gData->_staminaRecoverPoint* fish->GetLevel();
// eat fish
gData->_staminaPoint += 10;
fish->Die();
fish->setTag(OBJ_ORNAMENTAL);
auto layerEffect = (XEffectLayer*)playLayer->getChildByTag(LAYER_EFFECT);
layerEffect->XAddFishEatedEffect(fish->getPosition(), fish->GetLevel());
}
}
}
else if(a->getTag() == OBJ_BLOCK)
{
Rect fRect = a->getBoundingBox();
if(fRect.intersectsRect(pRect))
{
// game over
gData->_healthPoint -= 10;
a->setTag(OBJ_ORNAMENTAL);
JizGame::getInstance()->playAudioEffect("audioeffect/hurt1.mp3");
}
}
else if(a->getTag() == OBJ_TREASURE)
{
// eat treasure
Fish* fish = (Fish*)a;
Rect fRect = fish->getBoundingBox();
if(fRect.intersectsRect(pRect))
{
JizGame::getInstance()->playAudioEffect("audioeffect/eat2.mp3");
fish->Die();
fish->setTag(OBJ_ORNAMENTAL);
auto layerEffect = (XEffectLayer*)playLayer->getChildByTag(LAYER_EFFECT);
layerEffect->XAddFishEatedEffect(fish->getPosition(), fish->GetLevel());
}
}
}
}
// level up
{
if(gData->_experience >= gData->GetMaxExperience(gData->_level))
{
gData->_level++;
player->SetLevel(gData->_level);
// add max speed
gData->_maxRunSpeed += 50;
gData->_minRunSpeed += 50;
JizGame::getInstance()->playAudioEffect("audioeffect/levelup.mp3");
}
}
// validate play's positon
{
Vec2 curPos = player->getPosition();
if(curPos.y < 0)
{
gData->_healthPoint = 0;
JizGame::getInstance()->playAudioEffect("audioeffect/hurt2.mp3");
}
else
{
if(curPos.x < gData->EdgeWest)
{
curPos.x = gData->EdgeWest;
player->SetSlidslipSpeed(0);
}
else if(curPos.x > gData->EdgeEast)
{
curPos.x = gData->EdgeEast;
player->SetSlidslipSpeed(0);
}
player->setPosition(curPos);
}
}
}