Player constructor

Player({
  1. required Vector2 position,
  2. required double width,
  3. required double height,
  4. double life = 100,
  5. double speed = 100,
})

Implementation

Player({
  required Vector2 position,
  required double width,
  required double height,
  double life = 100,
  double speed = 100,
}) {
  this.speed = speed;
  receivesAttackFrom = ReceivesAttackFromEnum.ENEMY;
  initialLife(life);
  this.position = Rect.fromLTWH(
    position.x,
    position.y,
    width,
    height,
  ).toVector2Rect();
}