simpleAttackRange method
void
simpleAttackRange({
- required Future<
SpriteAnimation> animation, - required Future<
SpriteAnimation> animationDestroy, - required Vector2 size,
- Vector2? destroySize,
- double? radAngleDirection,
- int? id,
- double speed = 150,
- double damage = 1,
- int interval = 1000,
- bool withDecorationCollision = true,
- VoidCallback? onDestroy,
- ShapeHitbox? collision,
- VoidCallback? onExecute,
- LightingConfig? lightingConfig,
- Vector2? centerOffset,
- double marginFromOrigin = 16,
Execute the ranged attack using a component with animation
Implementation
void simpleAttackRange({
/// use animation facing right.
required Future<SpriteAnimation> animation,
required Future<SpriteAnimation> animationDestroy,
required Vector2 size,
Vector2? destroySize,
double? radAngleDirection,
int? id,
double speed = 150,
double damage = 1,
int interval = 1000,
bool withDecorationCollision = true,
VoidCallback? onDestroy,
ShapeHitbox? collision,
VoidCallback? onExecute,
LightingConfig? lightingConfig,
Vector2? centerOffset,
double marginFromOrigin = 16,
}) {
if (!checkInterval('attackRange', interval, dtUpdate)) return;
if (isDead) return;
simpleAttackRangeByAngle(
animation: animation,
animationDestroy: animationDestroy,
size: size,
angle: radAngleDirection ?? angle,
id: id,
speed: speed,
damage: damage,
withDecorationCollision: withDecorationCollision,
onDestroy: onDestroy,
destroySize: destroySize,
collision: collision,
lightingConfig: lightingConfig,
centerOffset: centerOffset,
marginFromOrigin: marginFromOrigin,
attackFrom: AttackOriginEnum.ENEMY,
);
onExecute?.call();
}