Utils

class game_state.utils.StateArgs(*, state_name, **kwargs)

A dataclass to send data to states while loading them in the manager.

Added in version 2.1.

Parameters:
  • state_name (str) – The name of the state which the argument belongs to.

  • kwargs (Any) – The data that needs to be sent.

get_data()

Returns the data to be passed on to the state. The data returned does not contain state_name in it.

Added in version 2.1.

Return type:

Dict[str, Any]

Returns:

The data of the state arg. Does not include state_name in it.

game_state.utils.MISSING = _MissingSentinel()

Used in areas where an attribute doesn’t have a value by default but gets defined during runtime. Lesser type checking would be required by using this, opposed to using some other default value such as None.

Added in version 2.0.1.