gameEngine/gameEngine/Scene.cpp
//if Scene is active, tell Sprites to update and check Sensors.
if Scene is active, tell Sprites to update and check Sensors.
if Scene is active tell Sprites to update and check Sensors .
void Scene::Update(GLfloat dt)
{
	if (this->active)
	{
		for (int i = 0; i < MovingSceneObjects.size(); i++)
		{
			if (MovingSceneObjects.at(i)->getActive())
			{
				MovingSceneObjects.at(i)->checkBounds(this->width, this->height);
				MovingSceneObjects.at(i)->Update();
				if (MovingSceneObjects.at(i)->getDebug())
				{
					std::cout << "Name:" << MovingSceneObjects.at(i)->getName() << std::endl;
					std::cout << "Bound Action:" << MovingSceneObjects.at(i)->getBoundAction() << std::endl;
					std::cout << "Pos:" << MovingSceneObjects.at(i)->getPosition().x << ", " << MovingSceneObjects.at(i)->getPosition().y << std::endl;
					std::cout << "Size:" << MovingSceneObjects.at(i)->getSize().x << ", " << MovingSceneObjects.at(i)->getSize().y << std::endl;
					std::cout << "Rotation:" << MovingSceneObjects.at(i)->getRotation() << std::endl;
				}
			}
		}
		for (int i = 0; i < sensors.size(); i++)
		{
			sensors.at(i)->sense();
		}
		for (int i = 0; i < observers.size(); i++)
		{
			observers.at(i)->Notify();
		}
	}
}
void Scene :: Update ( GLfloat dt ) { if ( this -> active ) { for ( int i = 0 ; i < MovingSceneObjects . size ( ) ; i ++ ) { if ( MovingSceneObjects . at ( i ) -> getActive ( ) ) { MovingSceneObjects . at ( i ) -> checkBounds ( this -> width , this -> height ) ; MovingSceneObjects . at ( i ) -> Update ( ) ; if ( MovingSceneObjects . at ( i ) -> getDebug ( ) ) { std :: cout << " " << MovingSceneObjects . at ( i ) -> getName ( ) << std :: endl ; std :: cout << " " << MovingSceneObjects . at ( i ) -> getBoundAction ( ) << std :: endl ; std :: cout << " " << MovingSceneObjects . at ( i ) -> getPosition ( ) . x << " " << MovingSceneObjects . at ( i ) -> getPosition ( ) . y << std :: endl ; std :: cout << " " << MovingSceneObjects . at ( i ) -> getSize ( ) . x << " " << MovingSceneObjects . at ( i ) -> getSize ( ) . y << std :: endl ; std :: cout << " " << MovingSceneObjects . at ( i ) -> getRotation ( ) << std :: endl ; } } } for ( int i = 0 ; i < sensors . size ( ) ; i ++ ) { sensors . at ( i ) -> sense ( ) ; } for ( int i = 0 ; i < observers . size ( ) ; i ++ ) { observers . at ( i ) -> Notify ( ) ; } } }
if Scene is active, tell Sprites to update and check Sensors.
if Scene is active tell Sprites to update and check Sensors .
//for each sprite in scene