Page 2 of 2

Re: OpenGL fade effect

Posted: Mon Sep 13, 2010 10:18 pm
by jjackdev
Its in the code I posted earlier. It looks like this.

Code: Select all

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;
			}	
		}

Re: OpenGL fade effect

Posted: Mon Sep 13, 2010 10:31 pm
by WSPSNIPER
jjackdev wrote:Its in the code I posted earlier. It looks like this.

Code: Select all

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...

Re: OpenGL fade effect

Posted: Tue Sep 14, 2010 3:07 pm
by jjackdev
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.

Re: OpenGL fade effect

Posted: Tue Sep 14, 2010 5:48 pm
by jjackdev
WSPSNIPER : Thank you so much I used your new updated method and it works even with the warp.Thank you so much

Re: OpenGL fade effect

Posted: Tue Sep 14, 2010 6:16 pm
by WSPSNIPER
jjackdev wrote:WSPSNIPER : Thank you so much I used your new updated method and it works even with the warp.Thank you so much

YAY!!! you're welcome! im just glad to help :mrgreen:

Re: OpenGL fade effect

Posted: Tue Sep 14, 2010 10:30 pm
by TheBuzzSaw
I have a fade effect inside my fragment shader. It's quite handy.