PolygonHitbox.relative constructor

PolygonHitbox.relative(
  1. List<Vector2> relation, {
  2. required Vector2 parentSize,
  3. Vector2? position,
  4. double angle = 0,
  5. Anchor? anchor,
  6. bool isSolid = false,
  7. CollisionType collisionType = CollisionType.active,
})

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(
  super.relation, {
  required super.parentSize,
  super.position,
  double super.angle = 0,
  super.anchor,
  bool isSolid = false,
  CollisionType collisionType = CollisionType.active,
}) : super.relative(shrinkToBounds: true) {
  this.isSolid = isSolid;
  this.collisionType = collisionType;
}