cocos.scene module

Scene class and subclasses

class Scene(*children)

Bases: cocos.cocosnode.CocosNode, cocos.scene.EventHandlerMixin

enable_handlers(value=True)

This function makes the scene elegible for receiving events

end(value=None)

Ends the current scene setting director.return_value with value

Parameters:
value : anything

The return value. It can be anything. A type or an instance.

load_music(filename)

This prepares a streamed music file to be played in this scene.

Music will be stopped after calling this (even if it was playing before).

Parameters:
filename : fullpath

Filename of music to load. Depending on installed libraries, supported formats may be WAV, MP3, OGG, MOD; You can also use ‘None’ to unset music

on_enter()
on_exit()
play_music()

Enable music playback for this scene. Nothing happens if music was already playing

Note that if you call this method on an inactive scene, the music will start playing back only if/when the scene gets activated.

push_all_handlers()
remove_all_handlers()
stop_music()

Stops music playback for this scene.