static void move() { switch ( status ) { case TITLE: moveTitleMenu(); moveBoss(); moveFoes(); moveBackground(); break; case IN_GAME: case STAGE_CLEAR: moveShip(); moveBoss(); moveLasers(); moveShots(); moveFoes(); moveFrags(); moveBackground(); break; case GAMEOVER: moveGameover(); moveBoss(); moveFoes(); moveFrags(); moveBackground(); break; case PAUSE: movePause(); break; } moveScreenShake(); }
static void move() { switch ( status ) { case TITLE: moveTitleMenu(); moveBackground(); addBullets(); moveFoes(); break; case IN_GAME: moveBackground(); addBullets(); moveShots(); moveShip(); moveFoes(); moveFrags(); moveBonuses(); break; case GAMEOVER: moveGameover(); moveBackground(); addBullets(); moveShots(); moveFoes(); moveFrags(); break; case STAGE_CLEAR: moveStageClear(); moveBackground(); moveShots(); moveShip(); moveFrags(); moveBonuses(); break; case PAUSE: movePause(); break; } }
void RenderManager::update(uint deltaTimeInMillis) { // An inverse velocity of 0 would be infinitely fast, so we'll let 0 mean no velocity. if (_backgroundInverseVelocity != 0) { _accumulatedVelocityMilliseconds += deltaTimeInMillis; uint absVelocity = uint(abs(_backgroundInverseVelocity)); int numberOfSteps = 0; while (_accumulatedVelocityMilliseconds >= absVelocity) { _accumulatedVelocityMilliseconds -= absVelocity; numberOfSteps++; } // Choose the direction of movement using the sign of the velocity moveBackground(_backgroundInverseVelocity < 0 ? -numberOfSteps : numberOfSteps); } }
void Background::Update(float elapsedTime) { // update the player position glm::vec2 moveBackground(0.5f, 0); m_sprite.Move(moveBackground); }
void RenderManager::setBackgroundImage(const Common::String &fileName) { readImageToSurface(fileName, _currentBackground); moveBackground(0); }