CLASS v1.8.0

Circle

pykraken.Circle

Represents a circle shape with position and radius.

More about Circle

Supports collision detection with points, rectangles, other circles, and lines.

Reference

PYTHON API

Constructor

method4 overloads
Circle()
Circle(radius: float)
Circle(pos: Vec2, radius: float)
Circle(x: float, y: float, radius: float)

Overloaded function.

  1. Circle()

Create a circle with default position (0, 0) and radius 0.

  1. Circle(radius: float)

Create a circle with a specified radius at the default position (0, 0).

Args

  • radius (float) — The radius of the circle.
  1. Circle(pos: Vec2, radius: float)

Create a circle at a given position and radius.

Args

  • pos (Vec2) — Center position of the circle.
  • radius (float) — Radius of the circle.
  1. Circle(x: float, y: float, radius: float)

Create a circle at given x and y coordinates with a specified radius.

Args

  • x (float) — X coordinate of the circle's center.
  • y (float) — Y coordinate of the circle's center.
  • radius (float) — Radius of the circle.

area

property
area: float

Get the area of the circle.

bottom

property
bottom: float

Get or set the y coordinate of the bottommost point of the circle.

circumference: float

Get the circumference of the circle.

diameter

property
diameter: float

Get or set the diameter of the circle.

left

property
left: float

Get or set the x coordinate of the leftmost point of the circle.

pos

property
pos: Vec2

The center position of the circle as a Vec2.

radius

property
radius: float

The radius of the circle.

top

property
top: float

Get or set the y coordinate of the topmost point of the circle.

as_rect

method
as_rect(self) -> Rect

Return the smallest rectangle that fully contains the circle.

copy

method
copy(self) -> Circle

Return a copy of the circle.

Find your next step

Start typing to search the manual.