Example - Game_Bounce.js
cfg.Game, cfg.Portrait
function OnLoad()
{
gfx.AddPhysics( 20 )
gfx.Enclose( -1, "left,right" )
sky = gfx.CreateBackground( "/Sys/Img/Sky.jpg", "stretch" )
bunny = gfx.CreateSprite( "/Sys/Img/Bunny.png", "bunnies" )
floor = gfx.CreateRectangle( 1, 0.05, 0x338833, 0,0,1, "floor" )
}
function OnReady()
{
gfx.AddBackground( sky )
gfx.AddGraphic( floor, 0, 0.95 )
floor.SetPhysics( 2, "fixed", 0.9, 0.8, 0.1 )
gfx.AddSprite( bunny, 0.2, 0.2, 0.05 )
bunny.SetPhysics( 1, "Dynamic", 0.5, 0.9, 0.1 )
bunny.SetVelocity( 0.7, 0 )
gfx.Play()
}
def OnLoad():
global sky, bunny, floor
gfx.AddPhysics(20)
gfx.Enclose(-1, "left,right")
sky = gfx.CreateBackground("/Sys/Img/Sky.jpg", "stretch")
bunny = gfx.CreateSprite("/Sys/Img/Bunny.png", "bunnies")
floor = gfx.CreateRectangle(1, 0.05, 0x338833, 0, 0, 1, "floor")
def OnReady():
gfx.AddBackground(sky)
gfx.AddGraphic(floor, 0, 0.95)
floor.SetPhysics(2, "fixed", 0.9, 0.8, 0.1)
gfx.AddSprite(bunny, 0.2, 0.2, 0.05)
bunny.SetPhysics(1, "Dynamic", 0.5, 0.9, 0.1)
bunny.SetVelocity(0.7, 0)
gfx.Play()
Example - Demo
function OnStart()
{
app.CopyFile("/assets/samples/Game_Bounce.js", "script.js");
app.CreateGame("script.js", "landscape");
}
from native import app
def OnStart():
app.CopyFile("/assets/samples/Game_Bounce.js", "script.js")
app.CreateGame("script.js", "landscape")