Fade-out

Posted By: rcth

Fade-out - 03/08/12 16:59

Hi,

I've made a fade-in script, but after the fade-in, it won't fade-out.
Script:
Quote:

PANEL* splash =
{
pos_x = 230;
pos_y = 10;
bmap = "start1.bmp";
}
set(splash, SHOW);
wait(1);
set(splash,TRANSLUCENT);
for (splash.alpha=0; splash.alpha+=5*time_step; splash.alpha<100) wait(5);
if(splash.alpha=100) {
for (splash.alpha=100; splash.alpha-=5*time_step; splash.alpha>0) wait(5);
}


So anyone?
Posted By: Superku

Re: Fade-out - 03/08/12 17:10

Why do you check if(splash.alpha=100)? Normally, splash.alpha will mostly never be exactly 100 after the first for loop, more like 100.3, 100.07 or something like that. Then there is missing a second "=", so you don't compare the values, but you assign 100 to splash.alpha. Then you've got the for loops messed up a little, it should be:

for (splash.alpha=0; splash.alpha<100; splash.alpha+=time_step) wait(1);
instead of
for (splash.alpha=0; splash.alpha+=5*time_step; splash.alpha<100) wait(5);
Posted By: rcth

Re: Fade-out - 03/08/12 18:11

I'll test it, thanks!
Posted By: MrGuest

Re: Fade-out - 03/09/12 00:44

you could just remove the if statement altogether, you know it must be greater than or equal to 100 after the first for loop.

preferably i'd use a while loop
Code:
while(splash.alpha < 100){
  splash.alpha += 5*time_step; //change this to change the speed
  wait(5); //change this to 1 otherwise you'll get uneven fading.
}

wait(-1); //keep onscreen for 1 second
while(splash.alpha > 0){
  splash.alpha -= 5*time_step; //as above
  wait(5); //as above
}

though the result would be the same
Posted By: rcth

Re: Fade-out - 03/09/12 15:47

Ok, thanks all. It's working!

Anyway, a new question: Is there no way to:
* Use the old A7 physics engine in A8?
* Buy A7.X now?
Posted By: 3run

Re: Fade-out - 03/09/12 15:54

I don't think that there are anyways to buy officially A7 license any more, ony from hands. Better learn PhysX, it's more stable in my opinion.
Posted By: rcth

Re: Fade-out - 03/09/12 16:04

awh, ok... Are there btw any c-script tutorials? I only can find some from lite-c.
Posted By: Superku

Re: Fade-out - 03/09/12 16:56

Why do you want to use the ODE physics engine, buy A7 and learn C-Script?
C-Script is dead and far inferior to lite-C.
Posted By: rcth

Re: Fade-out - 03/09/12 17:10

Because all the help I get for a really specific type of making games is in the old A7 engine with old physics, that's why. And c-script is another reason.
Posted By: Ch40zzC0d3r

Re: Fade-out - 03/09/12 19:09

These arguments are just shit. You wanna see what you can do with A8 and lite-c?
I will post anywhen this year my FPS game for free!
I hope you all enjoy it grin
© 2024 lite-C Forums