Gate::Gate(Coordinate pos) { top = true; SetImage( Image::Get("Resources/Graphics/gate1_top.png") ); // Create the PartnerID Gate Gate* partner = new Gate(this->GetID()); partnerID = partner->GetID(); exitID = 0; SpriteManager::Instance()->Add((Sprite*)partner); // Set both Position and Angle at the same time SetWorldPosition(pos); SetAngle( float( rand() %360 ) ); }
/**\brief Creates a Top Gate as well as a Bottom Gate automatically * \todo Remove the SpriteManager Instance access. */ Gate::Gate(Coordinate pos, string _name) { top = true; SetImage( Image::Get("Resources/Graphics/gate1_top.png") ); // Create the PartnerID Gate Gate* partner = new Gate(GetID()); partnerID = partner->GetID(); exitID = 0; SpriteManager::Instance()->Add((Sprite*)partner); // Set both Position and Angle at the same time SetWorldPosition(pos); SetAngle( float( rand() %360 ) ); if( _name == "" ) { stringstream val_ss; val_ss << GetID(); val_ss >> _name; }