This site permanently moved to
https://droidscript.github.io
. Please update links accordingly.
You are being forwarded automatically in 3...
[stay here]
Back
CreateBackground
Hello World
Content:
-
Methods
Creates a background.
bck = gfx.CreateBackground(
file
,
options
) →
game object:
Background
Example - Scroll
click to expand contents
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
)
;
}
Copy
Copy All
Run
Methods
The following methods are available on the
Background
object:
loaded
→
Boolean
Scroll
(
x
,
y
)
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
loading