本文整理汇总了C++中Boss::animate方法的典型用法代码示例。如果您正苦于以下问题:C++ Boss::animate方法的具体用法?C++ Boss::animate怎么用?C++ Boss::animate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boss
的用法示例。
在下文中一共展示了Boss::animate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: animate
/**
* Animation function, only put animation code here!
* That is to say, code that updates positioning of drawables.
*/
void animate( )
{
int currentTime = glutGet(GLUT_ELAPSED_TIME);
int deltaTime = currentTime - glutElapsedTime;
glutElapsedTime = currentTime;
LightPos[0] += 0.002;
for (int i = 0; i < numberOfRidges; i++)
{
mountains[i].move(deltaTime);
}
background->move(deltaTime);
groundfloor->move(deltaTime);
for (auto &enemy : enemies) {
enemy.animate(deltaTime);
}
for (auto &projectile : projectiles) {
projectile.animate(deltaTime);
}
character.animate(deltaTime);
character.position[0] = std::fmax(character.position[0], topLeft[0] + (character.width / 2.0f) * character.scale);
character.position[0] = std::fmin(character.position[0], bottomRight[0] - (character.width / 2.0f) * character.scale);
character.position[1] = std::fmin(character.position[1], topLeft[1] - (character.height / 2.0f) * character.scale);
character.position[1] = std::fmax(character.position[1], bottomRight[1] + (character.height / 2.0f) * character.scale + 1.0);
if (toggleBoss)
boss.animate(deltaTime);
collisionDetection();
// After everything has moved, lighting should be recalculated
computeLighting();
}