示例#1
0
void Player::update(sf::Time elapsedTime)
{
    updateMovement(elapsedTime);
    updateProjectiles(elapsedTime);

    if (getInvisible())
    {
        invisibleTime += elapsedTime;
        if (invisibleTime >= sf::seconds(10))
        {
            clearInvisible();
        }
    }
}
示例#2
0
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;
}
示例#3
0
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
}