PlatformEnemy constructor

PlatformEnemy({
  1. required Vector2 position,
  2. required Vector2 size,
  3. required PlatformAnimations animation,
  4. Direction initDirection = Direction.right,
  5. double? speed,
  6. double life = 100,
  7. int countJumps = 1,
})

Implementation

PlatformEnemy({
  required super.position,
  required super.size,
  required PlatformAnimations animation,
  Direction initDirection = Direction.right,
  double? speed,
  double life = 100,
  int countJumps = 1,
}) : super(
        initDirection: initDirection,
        speed: speed,
        life: life,
        animation: SimpleDirectionAnimation(
          idleRight: animation.idleRight,
          runRight: animation.runRight,
          idleLeft: animation.idleLeft,
          runLeft: animation.runLeft,
          others: {
            if (animation.jump?.jumpUpRight != null)
              JumpAnimationsEnum.jumpUpRight: animation.jump!.jumpUpRight,
            if (animation.jump?.jumpUpLeft != null)
              JumpAnimationsEnum.jumpUpLeft: animation.jump!.jumpUpLeft!,
            if (animation.jump?.jumpDownRight != null)
              JumpAnimationsEnum.jumpDownRight: animation.jump!.jumpDownRight,
            if (animation.jump?.jumpDownLeft != null)
              JumpAnimationsEnum.jumpDownLeft: animation.jump!.jumpDownLeft!,
            ...animation.others ?? {},
          },
          centerAnchor: animation.centerAnchor,
        ),
      ) {
  setupJumper(maxJump: countJumps);
}