Code
//Quickly checking Intersections.
for (std::vector<_Element>::iterator id = Elements.begin(); id != Elements.end(); ++id){
bool iLEFT=false, iRIGHT=false, iUP=false, iDOWN=false;
//if intersection with left
if (InterSection(this->Pos.x-32, (*id).Pos.x, this->Pos.y, (*id).Pos.y, this->Rect.width, (*id).Rect.width, this->Rect.height, (*id).Rect.height)) { iLEFT=true; }
//if intersection with right
if (InterSection(this->Pos.x+32, (*id).Pos.x, this->Pos.y, (*id).Pos.y, this->Rect.width, (*id).Rect.width, this->Rect.height, (*id).Rect.height)) { iRIGHT=true; }
//if intersection with up
if (InterSection(this->Pos.x, (*id).Pos.x, this->Pos.y-32, (*id).Pos.y, this->Rect.width, (*id).Rect.width, this->Rect.height, (*id).Rect.height)){ iUP=true; }
//if intersection with down
if (InterSection(this->Pos.x, (*id).Pos.x, this->Pos.y+32, (*id).Pos.y, this->Rect.width, (*id).Rect.width, this->Rect.height, (*id).Rect.height)) { iDOWN=true; }
if (iLEFT || iRIGHT) {this->textureLocation = sf::Vector2f(0, 0);}
if (iUP || iDOWN) {this->textureLocation = sf::Vector2f(64, 32);}
//CODE?! Y U NO WORK
if (iLEFT && iDOWN) {this->textureLocation = sf::Vector2f(32, 0);} //LEFT AND DOWNAA
if (iRIGHT && iDOWN) {this->textureLocation = sf::Vector2f(64, 0);} //RIGHT AND DOWNAA
if (iUP && iRIGHT) {this->textureLocation = sf::Vector2f(0, 32);} //RIGHT AND UPA
if (iUP && iLEFT) {this->textureLocation = sf::Vector2f(32, 32);} //LEFT AND UPA
}
Doesn't change Texture Location Properly.
I have been able to use variables by themselves (ie:
Code
if (iUP) {}
and it works just fine....)
What's the problem with &&?!?
Help....