Hi everyone , i really suck at making credits , texts or such thing :P . I want this , for example , in some movies , there is a black screen and there is a text which says T-Pr Production . But this text doesn't appear quickly , it appears slowly like it's transparency is increasing , and then it disappears slowly again like it's transparency is decreasing. So how can i do that in my game , i want to do that at the beginning like credits in for example left top corner of the room.
Put your text on a gui and use the code below to fade the gui in and out.
untested but
function Fade(this GUI*, int speed, bool fadeIn){
int temp;
if (fadeIn) {
this.Transparency = 100;
this.Visible = true;
while (this.Transparency > 0) {
temp = this.Transparency - speed;
if (temp < 0) temp = 0;
this.transparency = temp;
Wait(1);
}
}
else {
this.Transparency = 0;
while (this.Transparency < 100) {
temp = this.Transparency + speed;
if (temp > 100) temp = 100;
this.transparency = temp;
Wait(1);
}
this.Visible = false;
}
}
Usage is like this:
myGui.Fade(2, true); // fades in with a speed of 2.
myGui.Fade(4, false); // fades out with a speed of 4.
I did this without the editor so syntax errors are possible.
thank you very very much :), i changed it a little bit by using your codes in a way ;,
function room_FirstLoad()
{
int trans = gYazi1.Transparency;
while (trans > 0) {
trans--;
gYazi1.Transparency = trans;
Wait(1);
}
while (trans < 100) {
trans++;
gYazi1.Transparency = trans;
Wait(1);
}
player.ChangeRoom(8, 0, 0);
}
and it works , thanks a lot again :D .