本文整理汇总了C++中TimeManager::updateRandomShoot方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeManager::updateRandomShoot方法的具体用法?C++ TimeManager::updateRandomShoot怎么用?C++ TimeManager::updateRandomShoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeManager
的用法示例。
在下文中一共展示了TimeManager::updateRandomShoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Space Invaders");
//STARTING SETTINGS
AudioManager audioManager;
BulletManager bulletManager;
EnemyManager enemyManager;
Randomizer random;
TimeManager time;
Menu mainMenu;
Interface mainInterface;
Player player(400, 500);
Player *playerWsk = &player;
//CONTROL VARIABLES
bool menu = true;
bool init = false;
bool menuMusic = false;
bool stageTwo = false;
mainMenu.loadData();
while (window.isOpen())
{
if(menu == false)
{
if(init == false)
{
audioManager.stopMenu();
menuMusic = false;
player.setHealth(3);
//CREATING ENEMIES and INITILIAZING
enemyManager.addEnemies(); //2 ROWS
random.initialize();
audioManager.playMusic();
init = true;
}
if((stageTwo == false) && (mainInterface.getScore() >= 280))
{
enemyManager.addEnemiesMedium();
stageTwo = true;
}
if((mainInterface.getScore() >= 560))
{
audioManager.stopMusic();
init = false;
menu = true;
}
time.updateShoot();
time.updateRandomShoot();
// REFRESHING WINDOW
// ALL PHYSICS HERE
while(time.getAccumulator() > time.getUps())
{
time.updateAccumulator();
player.keyboardControl(time.getUps(), bulletManager, time.getShootTimer(), time, audioManager);
enemyManager.controlEnemies(random, bulletManager, time);
bulletManager.controlBullets(time.getUps());
//COLLISIONS
bulletManager.checkPlayerCollisions(playerWsk);
enemyManager.updateDead(bulletManager);
player.gameOver(audioManager, menu, init);
}
//SIMPLE EVENTS
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
mainInterface.checkRecords(mainMenu);
//DRAWING
window.clear();
mainInterface.drawText(window, player.getHealth());
enemyManager.drawEnemies(window);
window.draw(player.getSprite());
bulletManager.drawBullets(window);
window.display();
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
{
window.close();
}
//.........这里部分代码省略.........