RectangleHitbox.relative constructor

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

With this constructor you define the RectangleHitbox in relation to the parentSize. For example having relation as of (0.8, 0.5) would create a rectangle that fills 80% of the width and 50% of the height of parentSize.

Implementation

RectangleHitbox.relative(
  Vector2 relation, {
  Vector2? position,
  required Vector2 parentSize,
  double angle = 0,
  Anchor? anchor,
})  : shouldFillParent = false,
      super.relative(
        relation,
        position: position,
        parentSize: parentSize,
        angle: angle,
        anchor: anchor,
      );