for (int i = 0; i < TILE_SOLID_COUNT; i++) {
if (IsCollision(tileRect[i], playerRect) == true) {
collision = true;
if (i == 33) { //Collision with the warp
x = 303; //Set to center
y = 223; //Set to center
alpha = 0.0f; //Set the alpha to zero
fading = true; //Set the fading to true
}
if (movedX == true) {
if (movedRight == true) {
x-=5;
}
else {
x+=5;
}
}
//Collision response below
if (movedY == true) {
if (movedUp == true) {
y+=5;
}
else {
y-=5;
}
}
}
if (fading) {
break;
}
}
for (int i = 0; i < TILE_SOLID_COUNT; i++) {
if (IsCollision(tileRect[i], playerRect) == true) {
collision = true;
if (i == 33) { //Collision with the warp
x = 303; //Set to center
y = 223; //Set to center
alpha = 0.0f; //Set the alpha to zero
fading = true; //Set the fading to true
}
if (movedX == true) {
if (movedRight == true) {
x-=5;
}
else {
x+=5;
}
}
//Collision response below
if (movedY == true) {
if (movedUp == true) {
y+=5;
}
else {
y-=5;
}
}
}
if (fading) {
break;
}
}
well the if(fading) break wont make it fade but idk if thats what your code looks like...
Just ignore the if (fading) break; thing that is just a test to see if it will work but it doesn't. I got it to work I think it has to do with SDL and the OpenGL not communicating.