scenes

PP. scenes

The namespace containing functions for the scene management.
Source:

Methods

(static) add(scene_name, preload_function, create_function, update_function, destroy_function)

Add a new scene to the game. This function must be called before PP.game.start is executed.
Source:
Parameters:
Name Type Description
scene_name string A unique name for the scene to be created. It can be an arbitrary string.
preload_function function The function executed at the beginning, when the scene is loaded. It should contain the loading of the assets (images, sounds, etc.) and initialization stuff.
create_function function The function executed at the beginning, when the scene is created.
update_function function The function executed at each frame.
destroy_function function The function executed when the scene is destroyed.

(static) start(scene_name)

Stop the current scene (if any) and start a new one. This function is also used to start the whole game.
Source:
Parameters:
Name Type Description
scene_name string A unique name for the scene to be created. It can be an arbitrary string.

(static) start_overlay(scene_name)

Start a new one as overlay of the current one. This function pauses (but not stop) the current scene. Multiple overlays are not allowed, only one overlay at a time can be started.
Source:
Parameters:
Name Type Description
scene_name string A unique name for the scene to be created. It can be an arbitrary string.

(static) stop()

Stop the current scene.
Source:

(static) stop_overlay()

Remove the overlay and resume the main scene. It must be called within overlay scene functions.
Source: