PolygonHitbox.relative constructor

PolygonHitbox.relative(
  1. List<Vector2> relation, {
  2. Vector2? position,
  3. required Vector2 parentSize,
  4. double angle = 0,
  5. Anchor? anchor,
})

With this constructor you define the PolygonHitbox in relation to the parentSize of the hitbox.

Example: [[1.0, 0.0], [0.0, -1.0], [-1.0, 0.0], [0.0, 1.0]] This will form a diamond shape within the bounding size box. NOTE: Always define your shape in a counter-clockwise fashion (in the screen coordinate system)

Implementation

PolygonHitbox.relative(
  List<Vector2> relation, {
  Vector2? position,
  required Vector2 parentSize,
  double angle = 0,
  Anchor? anchor,
}) : super.relative(
        relation,
        position: position,
        parentSize: parentSize,
        angle: angle,
        anchor: anchor,
        shrinkToBounds: true,
      );