本文整理汇总了C++中Boss::move方法的典型用法代码示例。如果您正苦于以下问题:C++ Boss::move方法的具体用法?C++ Boss::move怎么用?C++ Boss::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boss
的用法示例。
在下文中一共展示了Boss::move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeBossPhases
std::vector<std::vector<Phase>> initializeBossPhases(World &world, Boss &boss)
{
std::vector<std::vector<Phase>> data(Boss::TypeCount);
// Welcome to one of the most un-readable code I've ever made :
// Boss1 Phase1
Phase b1p1(world, boss, sf::seconds(5.f));
b1p1.addSkill(sf::seconds(0.f), [&](Boss& b, sf::Time){
Player* player = world.getPlayerEntity();
//world.shakeCameraFor(0.3f);
boss.unsensible();
if((b.getPosition().x-player->getPosition().x) > 40) {
boss.move(Entity::Left);
} else if((b.getPosition().x-player->getPosition().x) < 40) {
boss.move(Entity::Right);
} else {
//boss.knock();
}
});
data[Boss::Boss1].push_back(b1p1);
// Boss1 Phase2
Phase b1p2(world, boss, sf::seconds(3.f));
b1p2.addSkill(sf::seconds(0.f), [&](Boss& b, sf::Time){
b.sensible();
});
data[Boss::Boss1].push_back(b1p2);
// Boss1 Phase3
Phase b1p3(world, boss, sf::seconds(1.f));
b1p3.addSkill(sf::seconds(0.9f), [&](Boss& b, sf::Time dt){
if(randomInt(0,5) == 1) world.addMedkit(sf::Vector2f(randomFloat(10, 1270), 20));
});
data[Boss::Boss1].push_back(b1p3);
// Boss1 Phase4
Phase b1p4(world, boss, sf::seconds(1.f));
b1p4.addSkill(sf::seconds(0.9f), [&](Boss& b, sf::Time dt){
Player* player = world.getPlayerEntity();
auto pos = player->getPosition();
//world.addZombie(sf::Vector2f(pos.x, 100.f));
//world.addZombie(sf::Vector2f(pos.x+50.f, 100.f));
world.addZombie(sf::Vector2f(randomFloat(10, 1270), 100.f));
b.playLocalSound(world.getCommandQueue(), Sounds::Boss1AddPop);
});
data[Boss::Boss1].push_back(b1p4);
//////////////////////////////////////////////
/*// Boss2 Phase2
Phase b2p2(world, boss, sf::seconds(2.f));
b2p2.addSkill(sf::seconds(0.90f), [&](Boss&, sf::Time){
});
data[Entity::Boss2].push_back(b2p2);
// Boss2 Phase1
Phase b2p1(world, boss, sf::seconds(1.2f));
b2p1.addSkill(sf::seconds(0.5f), [&](Boss& b, sf::Time){
PlayerEntity* player = world.player();
if((b.getPosition().x-player->getPosition().x) > 0) {
world.addCreature(2, 50.f);
} else {
world.addCreature(2, -50.f);
}
});
data[Entity::Boss2].push_back(b2p1);
// Boss2 Phase2
data[Entity::Boss2].push_back(b2p2);
data[Entity::Boss2].push_back(b2p1);
data[Entity::Boss2].push_back(b2p2);
data[Entity::Boss2].push_back(b2p1);
// Boss1 Phase4
Phase b2p3(world, boss, sf::seconds(0.f));
b2p3.addSkill(sf::seconds(0.f), [&](Boss& b, sf::Time dt){
PlayerEntity* player = world.player();
if(b.getPosition().x < 512) {
for(unsigned int i = 0; i < 5; ++i)
{
world.addCreature(2, 50.f + i*32.f);
}
world.addCreature(1, 380.f);
} else {
for(unsigned int i = 0; i < 5; ++i)
{
world.addCreature(2, -50.f - i*32.f);
}
world.addCreature(1, -380.f);
}
});
data[Entity::Boss2].push_back(b2p3);
// Boss2 Phase4
Phase b2p4(world, boss, sf::seconds(4.f));
b2p4.addSkill(sf::seconds(0.f), [&](Boss& b, sf::Time){
PlayerEntity* player = world.player();
if((b.getPosition().x-player->getPosition().x) > 0) {
boss.move(Entity::Left);
} else {
boss.move(Entity::Right);
}
});
data[Entity::Boss2].push_back(b2p4);
// Boss2 Phase5
Phase b2p5(world, boss, sf::seconds(2.f));
//.........这里部分代码省略.........