当前位置: 首页>>代码示例>>C++>>正文


C++ Boss::SetPosition方法代码示例

本文整理汇总了C++中Boss::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Boss::SetPosition方法的具体用法?C++ Boss::SetPosition怎么用?C++ Boss::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Boss的用法示例。


在下文中一共展示了Boss::SetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Start

void Game::Start(void)
{
  if(_gameState != Uninitialized)
    return;

  _mainWindow.Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32),"Paint Wars!");

  SFMLSoundProvider soundProvider;
  ServiceLocator::RegisterAudioService(&soundProvider);

  ServiceLocator::GetAudio()->PlaySong("assets/NewSoundtrack.ogg",true);

  PlayerShip *player1 = new PlayerShip();
  player1->SetPosition(SCREEN_WIDTH/2, _gameField.Bottom - 40);
  _gameObjectManager.Add("Ship1", player1);
  Laser *laser1 = new Laser();
  laser1->SetPosition(Game::SCREEN_WIDTH / 2, Game::SCREEN_HEIGHT + 100);
  _gameObjectManager.Add("Laser1", laser1);
   AIShip *enemy1 = new AIShip();
   enemy1->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy1", enemy1);
   AIShip *enemy2 = new AIShip();
   enemy2->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy2", enemy2);
   AIShip *enemy3 = new AIShip();
   enemy3->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy3", enemy3);
   AILaser *ailaser1 = new AILaser();
   ailaser1->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser1", ailaser1);
   AILaser2 *ailaser2 = new AILaser2();
   ailaser2->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser2", ailaser2);
   AILaser3 *ailaser3 = new AILaser3();
   ailaser3->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser3", ailaser3);
   Boss *boss = new Boss();
   boss->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("Boss", boss);
   BossLaser *bosslaser = new BossLaser();
   bosslaser->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("BossLaser",bosslaser);
   WeaponPowerUp *weaponpowerup = new WeaponPowerUp();
    weaponpowerup->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("WeaponPowerUp",weaponpowerup);
    ShieldPowerUp *shieldpowerup = new ShieldPowerUp();
    shieldpowerup->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("ShieldPowerUp",shieldpowerup);
   
   _gameState = Game::ShowingSplash;

  while(!IsExiting())
  {
    GameLoop();
  }

  _mainWindow.Close();
}
开发者ID:NicodySazawa,项目名称:Paint_Wars_C_Plus_Plus_Sample,代码行数:58,代码来源:game.cpp


注:本文中的Boss::SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。