本文整理汇总了C++中Enemy::Initialise方法的典型用法代码示例。如果您正苦于以下问题:C++ Enemy::Initialise方法的具体用法?C++ Enemy::Initialise怎么用?C++ Enemy::Initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy::Initialise方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enemy
void
Game::SpawnEnemy(float x, float y)
{
Enemy* e = new Enemy();
Sprite* rabbitLeft = m_pBackBuffer->CreateSprite("assets\\rabbit.png");
e->Initialise(rabbitLeft);
e->SetPositionX(x);
e->SetPositionY(y);
e->SetHorizontalVelocity(-0.5f);
m_EnemyVector.push_back(e);
}
示例2: Enemy
// Ex006.3: Spawn a Enemy in game.
void
Game::SpawnEnemy(int x, int y)
{
// Ex006.3: Load the alien enemy sprite file.
Sprite* pEnemySprite = m_pBackBuffer->CreateSprite("assets\\alienenemy.png");
// Ex006.3: Create a new Enemy object.
Enemy* enemy = new Enemy();
// set center handles
pEnemySprite->SetHandleCenter();
// Initialize the enemy object
enemy->Initialise(pEnemySprite);
// set the position of the Enemy object
enemy->SetPositionX(x);
enemy->SetPositionY(y);
// Ex006.3: Add the new Enemy to the enemy container.
m_enemyShip.push_back(enemy);
}
示例3: frameRenderingQueued
//-------------------------------------------------------------------------------------
bool BaseApplication::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
if(mWindow->isClosed())
return false;
if(mShutDown)
return false;
//Need to capture/update each device
mKeyboard->capture();
mMouse->capture();
mTrayMgr->frameRenderingQueued(evt);
FModManager::System()->update();
if (!mTrayMgr->isDialogVisible())
{
//mCameraMan->frameRenderingQueued(evt); // if dialog isn't up, then update the camera
if (mDetailsPanel->isVisible()) // if details panel is visible, then update its contents
{
mDetailsPanel->setParamValue(0, Ogre::StringConverter::toString((int)charge));
mDetailsPanel->setParamValue(2, Ogre::StringConverter::toString(mCamera->getDerivedPosition().z));
mDetailsPanel->setParamValue(4, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().w));
mDetailsPanel->setParamValue(5, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().x));
mDetailsPanel->setParamValue(6, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().y));
mDetailsPanel->setParamValue(7, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().z));
}
}
if(gameStarted == true)
{
if(myTimer.getMilliseconds() >= difficulty && mEnemies.size() < numEnemies)
{
number = Ogre::StringConverter::toString(numEnemy + 1);
// Add the current element number to the entity/scene node name to avoid confusion
Ogre::Entity* myEnt = mSceneMgr->createEntity("enemy " + number, "ninja.mesh");
mNodes.push_back(mSceneMgr->getRootSceneNode()->createChildSceneNode("Node " + number));
////// Distance the nodes from each other, so they aren't at the same place, and then attach them
mNodes.at(numEnemy)->setPosition((numEnemy) * -50 , 0, 0);
mNodes.at(numEnemy)->attachObject(myEnt);
mNodes.at(numEnemy)->scale(0.2,0.2,0.2);
Enemy* ninja = new Enemy(mNodes.at(numEnemy), Ogre::Vector3(0, 0, 0), cannons[myTimer.getMilliseconds()%3]->getPosition(), myTimer.getMilliseconds()%3);
ninja->Initialise();
mEnemies.push_back(ninja);
numEnemy++;
myTimer.reset();
}
}
//if the game is not over
if(endGame == false)
{
//check if cannons health are 0
if(cannons[0]->getHealth() <= 0 && cannons[1]->getHealth() <= 0
&& cannons[2]->getHealth() <= 0)
{
//end the game and call the endgame menu
endGame = true;
endGameMenu();
}
count = 0;
for(int i = 0; i < mEnemies.size(); i++)
{
//count all of the enemies that are dead
if(mEnemies[i]->isAlive() == false)
{
count++;
}
}
if(gameStarted == true)
{
//if the number of dead enemies are the same
//as the amount in the vector call gameOver
if(count == numEnemy)
{
endGame = true;
endGameMenu();
}
}
}
double timeChange = evt.timeSinceLastFrame;
//update Panel
mPanel->injectTime(evt.timeSinceLastFrame);
if(gameStarted == true)
{
mPanel->mNode->setPosition(0,-2000,0);
// Quit on ESCAPE Keyboard
mKeyboard->capture();
//.........这里部分代码省略.........