本文整理汇总了C++中Projectile::fireContinued方法的典型用法代码示例。如果您正苦于以下问题:C++ Projectile::fireContinued方法的具体用法?C++ Projectile::fireContinued怎么用?C++ Projectile::fireContinued使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile::fireContinued方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainGameTimer
void mainGameTimer(int x) {
#define MAX_DAMAGE 10
for(int i = 0; i < ships.size(); i++) {
Ship * s = ships[i];
if (s->getIsHit()) {
bool isStillDying = s->animateDeath();
if (isStillDying) {
// leaving this unfinished for the ships for now
}
}
else {
s->move();
}
}
bool allWalkersAreInactive = true; // assume true unless otherwise proven
for(int i = 0; i < walkers.size(); i++) {
Walker * w = walkers[i];
if (w->getIsInactive()) {
// do nothing
}
else if (w->getIsDying()) {
setStatusBarText("You've taken down a walker!");
bool isStillDying = w->animateDeath();
if (isStillDying) {
allWalkersAreInactive = false;
}
}
else {
w->walk(0);
allWalkersAreInactive = false;
#define MAX_GAMEOVER_COUNTER 700
if (w->getPositionOfHead()[2] > 0 && _gameOverCounter == 0) {
setStatusBarText("You've let a walker get through. GAME OVER");
for(int i = 0; i < 3; i++) light_level_during_gameover[i] = 0.5;
_gameOverCounter++;
}
}
}
if(_gameOverCounter == 0 && _damageCounter > MAX_DAMAGE) {
setStatusBarText("A walker has killed you... GAME OVER");
_gameOverCounter = 1;
}
if (_gameOverCounter > 0) {
// fade out the lights
for(int i = 0; i<3; i++) light_level_during_gameover[i] -= 0.001;
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_level_during_gameover);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_level_during_gameover);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_level_during_gameover);
glLightfv(GL_LIGHT1, GL_DIFFUSE, light_level_during_gameover);
glLightfv(GL_LIGHT1, GL_SPECULAR, light_level_during_gameover);
_gameOverCounter++;
if (_gameOverCounter > MAX_GAMEOVER_COUNTER) newGame();
}
/* if we killed them all, then go to the next round */
if (allWalkersAreInactive) {
for(int i = 0; i < walkers.size(); i++) {
Walker * w = walkers[i];
w->resetToStartPosition();
w->start();
}
_gameRound++;
_damageCounter = 0; // RESET DAMAGE EACH ROUND
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, model_ambient); // reset the ambient light
if (_gameRound < 10) addWalker(); // don't add too many enemies or it will be impossible
}
for(std::vector<Projectile*>::iterator itr = walkerProjectiles.begin(); itr != walkerProjectiles.end(); ++itr) {
Projectile * p = *itr;
if (p->fireContinued()) {
if (p->isColliding(cannon->getPosition())) {
stringstream s;
s << "You've been hit!!! Your damage level is " << _damageCounter << " out of " << MAX_DAMAGE << endl;
setStatusBarText(s.str());
_damageCounter++;
p->setIsFiring(false);
#define DAMAGE_COLOR_CHANGE 0.05
if (_damageCounter == 1) {
// reset the temp ambient light array so we can use it to fade to red
for(int i = 0; i < 3; i++) light_level_while_damaged[i] = model_ambient[i];
}
else {
light_level_while_damaged[0] += DAMAGE_COLOR_CHANGE;
light_level_while_damaged[1] -= DAMAGE_COLOR_CHANGE*0.5;
light_level_while_damaged[2] -= DAMAGE_COLOR_CHANGE*0.5;
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_level_while_damaged);
}
//.........这里部分代码省略.........