scene
FreeBodyEngine.core.scene
#
Scene(name)
#
A generic scene object. The Scene's purpose is to manage entities and handle interaction with the Main object.
name is the key the scene is registered under with
SceneManager/add_scene.
camera = None
instance-attribute
#
isinitialized = False
instance-attribute
#
name = name
instance-attribute
#
root = RootNode(self)
instance-attribute
#
add(*node)
#
Adds the entity to the scene and initializes it.
:param entity: The entity to be added. :type entity: Entity
on_initialize()
#
Called once, when the scene is added via SceneManager.add_scene;
override to build the scene's initial node tree. No-op by
default.
on_update()
#
Called when the scene is updated.
remove(*ids)
#
Removes the entity with the given id.
:param id: The id of the entity. :type id: UUID
toggle_debug_visuals()
#
Toggles the debug-visualization child node of every Collider2D
in the scene (added if missing, removed if present - see
Collider2D.toggle_debug_visuals).
SceneManager()
#
Bases: Service
Service that owns every registered Scene and drives the update/
physics of whichever one is active; only one scene updates at a time.
Registers this service under the name "scene_manager".
active_scene = None
instance-attribute
#
scenes = {}
instance-attribute
#
add_scene(scene)
#
Registers scene under its name and initializes it
immediately, regardless of whether it becomes the active scene.
get_active()
#
Returns the currently active Scene, or None if none is set.
on_destroy()
#
Unhooks update/physics_update from the engine's update
phases.
on_initialize()
#
Hooks this manager's update/physics_update into the engine's
UPDATE and PHYSICS update phases.
physics_update()
#
Runs the active scene's physics step, if there is one.
remove_scene(name)
#
Unregisters the scene named name, clearing active_scene too
if it was the active one.
set_scene(name)
#
Makes the scene named name the active one. Doesn't check that
a scene with that name has been added.
update()
#
Runs the active scene's update step, if there is one.
add_scene(scene)
#
Registers scene with the scene_manager service. Shorthand for
get_service('scene_manager').add_scene(scene).
remove_scene(name)
#
Unregisters the scene named name. Shorthand for
get_service('scene_manager').remove_scene(name).
set_scene(name)
#
Makes the scene named name the active one. Shorthand for
get_service('scene_manager').set_scene(name).