Tutorial 1: Fading images in/out on the screen.
Note: If you have the map running add
CODE
if (IsMapEngineRunning())
{
RenderMap() // Allows you to blit images to a map.
}
before you blit the image.
How to use, just add Intro(); before your game begins.
You need 5 images, 0-5, just add the number to the name of the _intro.png image.
CODE
EvaluateSystemScript("time.js");
function Delay(ms)
{
var until = GetTime() + ms;
while(until < GetTime());
}
function Intro()
{
// Intro images
var intro = []; // JS arrays can be dynamic.
for(var i = 0; i < 5; i++)
{
intro[i] = LoadImage((i).toString() + "_intro.png");
}
// loop le images
var tcolor = CreateColor(255,255,255,0);
var time = GetTime();
var delay = 500;
for(var i=0; i < 5; ++i)
{
while (tcolor.alpha < 255)
{
tcolor.alpha += Math.random(delay+1000*255)
intro[i].blitMask(0,0,tcolor);
FlipScreen();
}
Delay(1000);
while (tcolor.alpha > 0)
{
tcolor.alpha -= Math.random(delay+1000*255)
intro[i].blitMask(0,0,tcolor);
FlipScreen();
}
Delay(1000);
}
}