本文整理汇总了C++中AI::SetXPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ AI::SetXPosition方法的具体用法?C++ AI::SetXPosition怎么用?C++ AI::SetXPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AI
的用法示例。
在下文中一共展示了AI::SetXPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnBoss
//
// This function generates a boss AI for the dungeon at specified coordinates.
//
// @Param x - x coordinate of the spawn point
// @Param y - y coordinate of the spawn point
//
void AI_Group::SpawnBoss(int x, int y)
{
AI* ai;
std::random_device rd;
int sight, speed, type, health, ATK;
int lv = dungeon->Get_DungeonLevel();
BossActive = true;
type = rd() % 2; // Randomly pick either 0 or 1 (0 = Melee, 1 = Ranger)
BossID = rd() % 99999 + 1; // Get random ID value (up to 5 digits)
while (IDExists(BossID)) // Ensure the ID is unique
BossID = rd() % 99999 + 1;
sight = rd() % 3 + 3; // Sight ranges from 3 to 5
speed = rd() % 3 + 2; // Speed ranges from 2 to 4
health = rd() % 11 + 40 + (30 * (lv - 1)); // Health ranges from 40 to 50 (values get higher by 30 per level as dungeon level increases)
ATK = rd() % 4 + 10 + (5 * (lv - 1)); // ATK ranges from 10 to 13 (values get higher by 5 per level as dungeon level increases)
if (!type)
ai = new AI(e_queue, boss_melee_sprite, BOSS_MELEE, sight, speed, health, ATK);
else
ai = new AI(e_queue, boss_ranger_sprite, BOSS_RANGER, sight, speed, health, ATK);
ai->SetSpawn(*dungeon);
ai->SetXPosition(x);
ai->SetYPosition(y);
group.insert(std::pair<int, AI*>(BossID, ai));
}