本文整理汇总了C++中Monster::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Monster::GetPosition方法的具体用法?C++ Monster::GetPosition怎么用?C++ Monster::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster::GetPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CollideWithWall
void GameView::CollideWithWall(Monster& monster) {
const math::Vector3& vel = monster.GetVelocity();
if (monster.GetPosition().x < 0 || monster.GetPosition().x > width) {
monster.SetVelocity(-vel.x, vel.y, vel.z);
}
if (monster.GetPosition().y < 0 || monster.GetPosition().y > height) {
monster.SetVelocity(vel.x, -vel.y, vel.z);
}
}
示例2: paintMonsters
void FastWorldDrawer::paintMonsters() {
std::list<Monster *>::const_iterator it;
for (it = manager->GetModel()->GetMonsters().begin(); it != manager->GetModel()->GetMonsters().end(); ++it) {
glPushMatrix();
Monster *monster = *it;
glTranslatef(monster->GetPosition().getX(), monster->GetPosition().getY(), 0);
glRotatef(monster->GetAngle() * 180 / M_PI, 0, 0, 1);
glCallList(monsterListIndex);
glPopMatrix();
}
}
示例3: CollideWithCatchers
void GameView::CollideWithCatchers(Monster& monster) {
if (monster.IsAlive()) {
std::vector<CatchersPtr>::iterator it = m_catchers.begin();
while (it != m_catchers.end()) {
if (*it && (*it)->IsAlive()) {
bool result = CollideWithCatcher(monster, *(*it));
if (result) {
monster.SetState(Monster::StateDieing);
SpawnCatcher(monster.GetPosition());
++m_catchedMonsters;
MM::manager.PlaySample("scream_01", false, .2f);
break;
}
}
++it;
}
}
}
示例4: CollideWithCatcher
bool GameView::CollideWithCatcher(Monster& monster, Catcher& cathcer) {
IPoint deltaPoint = monster.GetPosition() - cathcer.GetPosition();
float distance = std::sqrt(deltaPoint.x * deltaPoint.x + deltaPoint.y * deltaPoint.y);
return distance < monster.Height() * 0.5f + cathcer.GetRadius();
}