本文整理汇总了C++中Shot::setActive方法的典型用法代码示例。如果您正苦于以下问题:C++ Shot::setActive方法的具体用法?C++ Shot::setActive怎么用?C++ Shot::setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shot
的用法示例。
在下文中一共展示了Shot::setActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkCollisionVsEnemyShots
void GameWorld::checkCollisionVsEnemyShots(GameObject* go)
{
Shot* shot;
Rect goRect = go->getRectangle();
for (int i = 0; i < m_gameObjectManager->getEnemyShotsInUse(); i++)
{
shot = m_gameObjectManager->getEnemyShot(i);
// Check that the shot is on screen. If not, remove.
shot->setActive(shot->collide(m_physicsComponent, m_cameraView));
if (!shot->getActive())
{
m_gameObjectManager->removeEnemyShot(i);
i--;
continue;
}
if ( shot->collide(m_physicsComponent, goRect) )
{
go->Health -= shot->Damage;
m_gameObjectManager->removeEnemyShot(i);
i--;
continue;
}
}
}
示例2: checkCollisionVsPlayersShots
void GameWorld::checkCollisionVsPlayersShots(GameObject* go)
{
Shot* shot;
for (int j = 0; j < m_gameObjectManager->getPlayerShotsInUse(); j ++)
{
shot = m_gameObjectManager->getPlayerShot(j);
// Check that the shot is on screen. If not, remove.
shot->setActive(shot->collide(m_physicsComponent, m_cameraView));
if (!shot->getActive())
{
m_gameObjectManager->removePlayerShot(j);
j--;
continue;
}
// check if shot hits enemy.
if ( shot->collide(m_physicsComponent, go->getRectangle()))
{
go->Health -= shot->Damage;
m_gameObjectManager->removePlayerShot(j);
j--;
continue;
}
}
}