Fork me on GitHub


Lifecycle functions

The lifecycle of a pyckitup game consists of these functions:

  1. def init() -> State

Initializes assets, returns a state object which can be an integer, a list, a dictionary or practically any Python object.

  1. def onload(State) -> None

This function is run exactly once after window creation. Can be used for setting frame rate, getting window size, etc..

  1. def update(State) -> None

This function is guaranteeed to run once per frame.

  1. def draw(State) -> None

Draw your game visuals here. In contrast to update function above, there is no once-per-frame guarantee.

  1. def event(State, Event) -> None

Event is a dictionary containing the event type and its associated data.