Call ppgame:start(fn) to change the function that the engine calls to update your game.
By default, the engine will call your function called "start" but you can update this at run time based on your game logic. For example, you might call ppgame:start(mainmenu) and then later ppgame:start(play) and then ppgame:start(gameover). The argument you pass is a lua closure.
Game Loop function.
local timer=0 --default game loop is start() function start() ppgraph:print("first loop"); timer=timer+1 --1second later. if timer>60 then --change game loop. ppgame:start(title) end end function title() ppgraph:print("second loop"); end
Returns a string that identifies which platform your game is running on.
platform = ppgame:platform()
function start() ppgraph:print(ppgame:platform()) end
Returns the number of frames per second that your game is running at right now. This is useful for debugging. See also ppgame:deltaTime()
fps = ppgame:fps()
function start() ppgraph:print(ppgame:fps()) end
Returns the elapsed time in seconds since the last game loop iteration. For example, at 60 fps, ppgame:deltaTime() will return 1/60 = 0.01667
deltaTime = ppgame:deltaTime()
function start() local t=ppgame:deltaTime() ppgraph:print(t) end
Returns the position of the mouse pointer as a pppoint. This only works on the desktop, not iOS.
point = ppgame:mouse()
function start() local p=ppgame:mouse() ppgraph:print(p.x..","..p.y) end
Sets the master volume of the MML audio engine. If you don't pass a parameter, ppgame:volume() will return the current volume. Volume ranges from 0 = silent up to 1.0 for full volume.
volume = ppgame:volume()
You can save values between game sessions. This is useful for saving high scores, or your character in an RPG.
Get values that have been previously saved with setNumber, setInteger and setString. If no value has been set, null is returned.
local score = ppgame:getInteger("score",100) ppgame:setInteger("score",200) function start() ppgraph:print(score) end