For as simple as the tutorials make
ppb look there’s a lot of power under
the hood. This section will cover the raw what of the ppb API. To find out why
decisions are made, see the Discussion section.
A python game framework.
PursuedPyBear is object oriented and event driven. Practically, this means that
most of your code will be organized into classes. Game objects in
Sprite instances, which get contained in
BaseScenes. In turn, the
contains the scenes and
Events are defined as simple classes and event handlers
are based on their names.
The classes, modules, and methods exported directly are the most used parts of the library and intended to be used by users at all levels (barring make_engine). Advanced features tend to be in their own modules and subpackages.
run(setup: Callable[[ppb.scenes.BaseScene], None] = None, *, log_level=30, starting_scene=<class 'ppb.scenes.BaseScene'>, title='PursuedPyBear', **engine_opts)¶
Run a game.
This is the default entry point for ppb games.
import ppb def setup(scene): scene.add(ppb.Sprite()) ppb.run(setup)
import ppb class Game(ppb.BaseScene): def __init__(self, **kwargs): super().__init__(**kwargs) self.add(ppb.Sprite()) ppb.run(starting_scene=Game)
See the Getting Started guide for a more complete guide to building games.
All parameters are optional.
- setup (Callable[[BaseScene], None]) – Called with the first scene to allow initialization of your game.
- log_level – The logging level from
logging()to send to the console.
- starting_scene (type) – A scene class to use. Defaults to
- title (str) – The title of the rendered window.
- engine_opts – Additional keyword arguments passed to the
make_engine(setup: Callable[[ppb.scenes.BaseScene], None] = None, *, starting_scene=<class 'ppb.scenes.BaseScene'>, title='PursedPyBear', **engine_opts)¶
A GameEngine instance.
- Game Object Model
- All About Scenes
- Text Rendering
- Sound Effects