gameEngine/gameEngine/SensorActuators/PositionActuator.cpp
//run based on given or defaulted conditon, if both x and y given assume set to that new pos, if only x or y set it while retaining other not given axis, if flip condition set vertex to negative, always ending up offscreen
run based on given or defaulted conditon, if both x and y given assume set to that new pos, if only x or y set it while retaining other not given axis, if flip condition set vertex to negative, always ending up offscreen
run based on given or defaulted conditon if both x and y given assume set to that new pos if only x or y set it while retaining other not given axis if flip condition set vertex to negative always ending up offscreen
void PositionActuator::run()
{
	if (condition == "both")
	{
		sprite->setPosition(glm::vec2(x,y));
	}
	else if (condition == "x")
	{
		sprite->setPosition(glm::vec2(x,sprite->getPosition().y));
	}
	else if (condition == "y")
	{
		sprite->setPosition(glm::vec2(sprite->getPosition().x, y));
	}
	else if (condition == "flip")
	{
		sprite->setPosition(glm::vec2(-sprite->getPosition().x, -sprite->getPosition().y));
	}
	else if (condition == "set")
	{
		one->setPosX(two->getPosX() + two->getWidth()/2);
		one->setPosY(two->getPosY() + two->getHeight()/2);
	}
	else if (condition == "objectPoolSet")
	{
		SceneObject *object = new SceneObject();
		if (OPS || OPSO)
			object = OPS->getObject();
		else
			std::cout << "\n error in Position Actuator, no suitiable Object Pool detected";
		object->setPosX(two->getPosX() + two->getWidth() / 2);
		object->setPosY(two->getPosY() + two->getHeight() / 2);
	}
}
void PositionActuator :: run ( ) { if ( condition == " " ) { sprite -> setPosition ( glm :: vec2 ( x , y ) ) ; } else if ( condition == " " ) { sprite -> setPosition ( glm :: vec2 ( x , sprite -> getPosition ( ) . y ) ) ; } else if ( condition == " " ) { sprite -> setPosition ( glm :: vec2 ( sprite -> getPosition ( ) . x , y ) ) ; } else if ( condition == " " ) { sprite -> setPosition ( glm :: vec2 ( - sprite -> getPosition ( ) . x , - sprite -> getPosition ( ) . y ) ) ; } else if ( condition == " " ) { one -> setPosX ( two -> getPosX ( ) + two -> getWidth ( ) / 2 ) ; one -> setPosY ( two -> getPosY ( ) + two -> getHeight ( ) / 2 ) ; } else if ( condition == " " ) { SceneObject * object = new SceneObject ( ) ; if ( OPS || OPSO ) object = OPS -> getObject ( ) ; else std :: cout << " \n " ; object -> setPosX ( two -> getPosX ( ) + two -> getWidth ( ) / 2 ) ; object -> setPosY ( two -> getPosY ( ) + two -> getHeight ( ) / 2 ) ; } }
run based on given or defaulted conditon, if both x and y given assume set to that new pos, if only x or y set it while retaining other not given axis, if flip condition set vertex to negative, always ending up offscreen
run based on given or defaulted conditon if both x and y given assume set to that new pos if only x or y set it while retaining other not given axis if flip condition set vertex to negative always ending up offscreen