Creates a background.
bck = gfx.CreateBackground(
file,
options )
→
game object: Background
Example - Scroll
cfg.Game;
function OnLoad()
{
sky = gfx.CreateBackground( "/Sys/Img/Sky.jpg", "stretch" );
}
function OnReady()
{
gfx.AddBackground( sky );
gfx.Play();
}
function OnAnimate(t,dt)
{
sky.Scroll(-dt/1000, 0);
}
Methods
The following methods are available on the Background object:
Number
String: path to file ( “/absolute/...” or “relative/...” )
String: comma “,” separated: “stretch”
Indicates if the background is ready for use
bck.Scroll
Scrolls the background by a given value