I'm planning on doing an intro where the background is black and white text comes up and then fades out, before more text comes up and fades. Is it an easy way to do this?
Remember I'm quite the n00b, so explain well. ;)
You could try making two background frames, one with your text in full white and one as a completely black background. Set the background frame of the room to the completely black frame. Then, just use RawDrawFrameTransparency to gradually fade in the text frame at different levels, from 0% (text gone) to 100% (text white). If you have more than one text message you want to fade in, just make a separate background for each message and use the same black background for fading.
Don't know if that will work, but it's worth a try, I suppose! :)
~Wolfgang
You could just make them animations, and then call the animations.
--------------
Or, harder by more coding
make your text objects on the screen, and then call them and then have them start as dark transparency
'SetObjectTransparency'
then run a loop that will continuously make it show til its done, then run a loop to make it fade, then bring up a new text element/object
I used fading text in my game in the intro. I did it using text overlays, and just setting the color of the overlays gradually from black to white. Here are the functions I used:
function fade_in_string(int textoverlay,string str,int x,int y,int width,int font,int speed) {
int Color=0;
while (Color<63422) {
Color+=2113;
SetTextOverlay(textoverlay,x,y,width,font,Color,str);
Wait(12-speed);
}
SetTextOverlay(textoverlay,x,y,width,font,65535,str);
}
function fade_out_string(int textoverlay,string str,int x,int y,int width,int font,int speed) {
int Color=65535;
while (Color>2113) {
Color-=2113;
SetTextOverlay(textoverlay,x,y,width,font,Color,str);
Wait(12-speed);
}
SetTextOverlay(textoverlay,x,y,width,font,0,str);
}
function do_fade() {
// here's how I would use the above functions:
int to;
// This line can remain constant
to=CreateTextOverlay(0,0,0,0,0,"");
// fade text in
fade_in_string(to,"Fading text",100,70,200,1,9);
// wait a little while
Wait(40);
// fade text out
fade_out_string(to,"Fading text",100,70,200,1,9);
// clean up
RemoveOverlay(to);
}
You can change the parameters of the fade_in_string and fade_out_string functions to suit your needs.
Here are the parameters and their explanations:
int textoverlay: This is the text overlay variable. You need to create a text overlay first and assign it to this variable and then pass this var to the function (just follow my example above)
string str: The string to display. Be sure to pass the same string to fade_in_string and fade_out_string; otherwise, the fading in string will be different text than the fading out string.
int x, y: x and y location on the screen
int width: width of the overlay. Play with this till it is the right width for your text
int font: font number to use
int speed: fade speed. The higher the number (up to 12) the faster the fade will be.
Hope this helps!
densming