Welcome Installation Getting Started User Interaction Build a Game #1 Build a Game #2 Build a Game #3 Colours Coordinates API Reference Globals Window Camera Mouse Key Rect Image Text Shape Line Screen Sound Base

Base

The Base class is a superclass. It provides a base for all drawable objects, so it can't be used directly.

x: float

The x position of the object.

y: float

The y position of the object.

pos, position: float, float

The position of the object.

  • x: float

    The object x position

  • y: float

    The object y position

scale: float, float

The scale of the object.

  • x: float

    The object x scale

  • y: float

    The object y scale

anchor: float, float

The offset applied when rotating the object.

  • x: float

    The object x anchor

  • y: float

    The object y anchor

angle: float

The rotation of the object in degrees.

red: float

The red colour of the object.

green: float

The green colour of the object.

blue: float

The blue colour of the object.

alpha: float

The transparency of the object.

color: float, float, float, float

The colour of the object.

  • r: float

    The red colour of the object

  • g: float

    The green colour of the object

  • b: float

    The blue colour of the object

  • a: float

    The transparency of the object

top: float

The top position of the object's bounding box.

bottom: float

The bottom position of the object's bounding box.

left: float

The left position of the object's bounding box.

The right position of the object's bounding box.

draw() -> None

Display the object, call this from the game loop.

blit(screen: Screen) -> None

Render the object to an offscreen surface.

  • screen: Screen

    The destination surface

collide(target: object) -> bool

Detect collision with another object.

  • target: object

    The object to detect collision against, can be a drawable or the mouse

look_at(target: object) -> None

Rotate the object to point towards a target.

  • target: object

    The target: a drawable, the mouse, or the camera

move_to(target: object, value = 1) -> None

Move the object towards a target at a certain speed.

  • target: object

    The target: a drawable, the mouse, or the camera

  • value: float

    The amount to move the object, default is 1

Sound