本文整理汇总了C++中StaticObject::moveAwayFromPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticObject::moveAwayFromPlayer方法的具体用法?C++ StaticObject::moveAwayFromPlayer怎么用?C++ StaticObject::moveAwayFromPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticObject
的用法示例。
在下文中一共展示了StaticObject::moveAwayFromPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BasicEnemy
void IceWorld::loadPhase2(irr::IrrlichtDevice * device){
//Unload the terrains from the scene
clearTerrains();
//Make sure the previous phase is no longer considered loaded
phase1Loaded = false;
//Get the references
irr::scene::ISceneManager *smgr = device->getSceneManager();
irr::video::IVideoDriver *driver = device->getVideoDriver();
//Set the random seed
srand(1);
//Reset the player position
player->changePosition(irr::core::vector3df(0, 0, 0));
//Make an array for the spawn order
int spawnOrder[10] = {1, 1, 2, 1, 2, 3, 1, 1, 3, 2};
//Set up the enemy positions
irr::f32 x = 0; irr::f32 y = 0; irr::f32 z = 500;
for(int i = 0; i < 20; i++){
//Deside which enemy to place
if(spawnOrder[i] == 1){
BasicEnemy *basicEnemy = new BasicEnemy(player, irr::core::vector3df(x, y, z), device->getTimer(), smgr);
} else if(spawnOrder[i] == 2){
FastEnemy *fastEnemy = new FastEnemy(player, irr::core::vector3df(x, y, z), device->getTimer(), smgr);
} else if(spawnOrder[i] == 3){
StrongEnemy *strongEnemy = new StrongEnemy(player, irr::core::vector3df(x, y, z), device->getTimer(), smgr);
}
z += 1500 + (player->getMovementSpeed() * 2.7f);
}
//Add some gems to the level
x = 0; y = 0; z = 1200;
for(int i = 0; i < 3; i++){
y = (irr::f32)(rand() % 40 + 1) - 20;
BronzeGem *gem = new BronzeGem(irr::core::vector3df(x, y, z), smgr);
gem->moveAwayFromPlayer(true, Game::getCurrentPlayer()->getMovementSpeed());
z += (rand() % 3000 + 1000) + (player->getMovementSpeed() * 2.7f);
}
//Add some asteroids to the level
x = 0; y = 0; z = 2000;
for(int i = 0; i < 14; i++){
y = (irr::f32)(rand() % 70 + 1) - 35;
StaticObject *Obsticle = new StaticObject(irr::core::vector3df(x, y, z), "Assets/Environment/Asteroid/Asteroid1.obj", "Assets/Environment/Asteroid/AsteroidTextureA.jpg", device->getSceneManager(), true);
Obsticle->moveAwayFromPlayer(true, Game::getCurrentPlayer()->getMovementSpeed());
z += (rand() % 500 + 500) + (player->getMovementSpeed() * 2.7f);
}
phase2Loaded = true;
}