本文整理汇总了C++中Food::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ Food::getParent方法的具体用法?C++ Food::getParent怎么用?C++ Food::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hitFoodTest
void InGameLayer::hitFoodTest()
{
Food* getFood = nullptr;
Point foodWorldPoint(0,0);
float dist = 0;
float dx = 0;
float dy = 0;
for (int i = foodList.size() - 1; i >= 0 ; i--)
{
getFood = foodList.at(i);
foodWorldPoint = getFood->getParent()->convertToWorldSpace(getFood->getPosition());
dx = mPanda->getPositionX() - foodWorldPoint.x;
dy = mPanda->getPositionY() - foodWorldPoint.y;
dist = sqrt(dx * dx + dy * dy );
if (dist <= 50 + 30)
{
if (getFood->getType() == FOOD_TYPE_JIU)
{
jiuPower += 150;
score += 50;
mPanda->playEffect(PANDA_EFFECT::PANDA_EFFECT_SPEED);
}else if (getFood->getType() == FOOD_TYPE_FOOD)
{
zhu++;
score += 20;
updateTextFiled(zhu,txtBambooCount);
}else if (getFood->getType() == FOOD_TYPE_ZHONG)
{
zhong++;
score += 10;
updateTextFiled(zhong,txtZhongCount);
}else if (getFood->getType() == FOOD_TYPE_BAO)
{
score += 60;
}
mFoodPool.takeIn(getFood);
elementLayer->removeChild(getFood);
foodList.eraseObject(getFood);
}
}
}