void Player::update(sf::Time elapsedTime) { updateMovement(elapsedTime); updateProjectiles(elapsedTime); if (getInvisible()) { invisibleTime += elapsedTime; if (invisibleTime >= sf::seconds(10)) { clearInvisible(); } } }
void Simulation::update() { updateProjectiles(); updatePlayers(); // remove players that don't have health left. auto pred = [](const std::pair<const std::string, Robot> &robot) { return robot.second.getHealth() <= 0; }; auto it = players.begin(); while ((it = std::find_if(it, players.end(), pred)) != players.end()) { std::string name = it->first; players.erase(it++); deathSignal(name); } simulationStepSignal(); runTime += rules.timeStep; }
void GameScene::update(float dt) { updateHero(dt); adaptPlayerPosition(); updateAnimationState(); m_flamesParticle->setPosition(ccpAdd(m_hero->getPosition(), ccp(-m_hero->getContentSize().width * 0.25f, -m_hero->getContentSize().height * 0.25f))); spawnEnemies(dt); updateEnemies(dt); updateProjectiles(dt); if (m_hp <= 0) { gameOver(); } m_background->update(); // Update Box2D world //world->Step(dt, 6, 3); // BOX2D TIP // Update objects from box2d coordinates here }