예제 #1
0
	void ticksAll(unsigned count, Vector::value_type dt) {
		tickAll(dt);
		while (--count) {
			updatePointAll();
			tickAll(dt);
		}
	}
/*runs the physics simulation until it is stopped*/
void MyLevel::run(){
	{
		Lock l(runningMutex);
		running=true;
	}
	float32 timeStep = 1.0f / stepsPerSecond;//seconds
	int32 velocityIterations = 6;
	int32 positionIterations = 2;
	LOG(INFO)<<"physics simulation of level started";
	bool bossEncounterStarted=false;
	try{
		while(isRunning()){
			if(!bossEncounterStarted && bossEncounter){
				bossEncounterStarted=true;
				startBossEncounter();
			}
			moveScreen();
			removeDead();
			createNewObjects();
			world.Step(timeStep, velocityIterations, positionIterations);
			tickAll(timeStep);
			redrawForClient();
			respawnAll();
			//if no megamans left exit
			if(allMegamansDead()){
				LOG(INFO)<<"all megamans dead";
				game->notify(new LevelFinished(LOST,id));
				this->stop();
			}
			usleep(timeStep* 1000000 );
		}
	}catch(std::exception& e){
		LOG(ERROR)<<e.what();
	}
	LOG(INFO)<<"physics simulation of level stopped";
}
예제 #3
0
파일: World.cpp 프로젝트: pac85/Engine
void world::UpdateWorld(float delta)
{
    update_attachments(delta);
    tickAll(delta);
}