本文整理汇总了C++中Monster::GetHealth方法的典型用法代码示例。如果您正苦于以下问题:C++ Monster::GetHealth方法的具体用法?C++ Monster::GetHealth怎么用?C++ Monster::GetHealth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster::GetHealth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(){
//Declare the characters
Hero Player;
Monster Ogre;
//Set the main characters in game properties
Player.SetName("Budi");
Player.SetHealth(1000);
Player.SetAttack(30);
Player.SetJob("Magician");
Player.SetTown("Furedator");
Ogre.SetName("Ograr");
Ogre.SetHealth(1500);
Ogre.SetAttack(15);
Ogre.SetClan("Myrtr");
cout << "Nama playernya adalah " << Player.GetName() << endl;
cout << "Player memiliki health " << Player.GetHealth() << endl;
cout << "Attack player adalah " << Player.GetAttack() << endl;
cout << "Job player adalah " << Player.GetJob() << endl;
cout << "Kota asal player adalah " << Player.GetTown() << endl;
cout << "Nama monsternya adalah " << Ogre.GetName() << endl;
cout << "Monsternya memiliki health " << Ogre.GetHealth() << endl;
cout << "Attack Monsternya adalah " << Ogre.GetAttack() << endl;
cout << "Clan Monsternya dari " << Ogre.GetClan() << endl;
return 0;
}
示例2: tick
//.........这里部分代码省略.........
Creature* m = dynamic_cast<Creature*>(tar);
QStringList str = monster->Flags.filter("HATE");
for (QString hate: str)
{
if (Hates[hate] == m->GetRace())
{
b = true;
break;
}
}
if (b)
{
Vector2 t_pos = tar->GetPosition();
distance2 = Sqr(m_pos.x - t_pos.x) + Sqr(m_pos.y - t_pos.y);
// Dasha told 5^2 is a protocol defined const
if (distance2 < 25)
{
monster->target = m;
break;
}
}
}
}
}
}
}
if (actor->GetType() == EActorType::MONSTER
|| actor->GetType() == EActorType::PLAYER)
{
Creature* monster = dynamic_cast<Creature*>(actor);
if (monster->GetHealth() <= 0)
{
KillActor_(actor);
break;
}
}
}
for (Actor* actor: actors_)
{
if (!actor
|| actor == nullptr)
{
break;
}
auto v = directionToVector[static_cast<unsigned>(actor->GetDirection())] ;
actor->SetVelocity(v);
float dt = playerVelocity_;
Vector2 old_pos = actor->GetPosition();
Vector2 new_pos = old_pos + v * (dt + 0.001);
Vector2 old_pos2 = old_pos + v * 0.51;
levelMap_.RemoveActor(actor);
EActorDirection d = actor->GetDirection();
float x = new_pos.x;
float y = new_pos.y;
if (levelMap_.GetCell(old_pos2.x, old_pos2.y) != '#'
&& d != EActorDirection::NONE
&& (((levelMap_.GetCell(x - slideThreshold_+ 0.5f, y) == '.'
&& levelMap_.GetCell(x + slideThreshold_- 0.5f, y) == '.')
&& (d == EActorDirection::NORTH
|| d == EActorDirection::SOUTH))
|| ((levelMap_.GetCell(x, y - slideThreshold_+ 0.5f) == '.'