本文整理汇总了C++中Sky::addEnemy方法的典型用法代码示例。如果您正苦于以下问题:C++ Sky::addEnemy方法的具体用法?C++ Sky::addEnemy怎么用?C++ Sky::addEnemy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sky
的用法示例。
在下文中一共展示了Sky::addEnemy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
srand (time (0));
sf::RenderWindow window (sf::VideoMode(480*0.5, 800*0.5), "Fighters");
window.setFramerateLimit(60);
PASS = 1;
Things::load ();
Sound::load ();
Text::load ();
Sky sky;
Hero hero;
Sound::GAME_MUSIC.play ();
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
// clear the window with black color
window.clear( sf::Color::Black );
int test = 0;
if ( hero.getRed() < -1 )
test = 1;
switch ( test )
{
case 1:
sky.gameover ( window );
Sound::GAME_MUSIC.play ();
break;
case 0:
if ( hero.getRed() > 0 )
{
Game ( hero );
if ( timeNow > TIME-PASS*10 )
{
timeNow = 0;
sky.addEnemy ( enemy, PASS);
}
timeNow++;
gapNow++;
sky.heroGunRunInto ( hero, enemy );
}
hero.gunMove ();
sky.draw ( window, hero );
drawEnemy ( window );
break;
}
levelUp ();
Text::outText ( window, hero.getRed(), PASS );
// end the current frame
window.display();
}
return 0;
}