FlyingAttackAngleObject constructor
FlyingAttackAngleObject({
- required Vector2 position,
- required Future<
SpriteAnimation> flyAnimation, - required double radAngle,
- required double width,
- required double height,
- dynamic id,
- Future<
SpriteAnimation> ? destroyAnimation, - double speed = 150,
- double damage = 1,
- AttackFromEnum attackFrom = AttackFromEnum.ENEMY,
- bool withCollision = true,
- VoidCallback? onDestroy,
- LightingConfig? lightingConfig,
- CollisionConfig? collision,
Implementation
FlyingAttackAngleObject({
required Vector2 position,
required Future<SpriteAnimation> flyAnimation,
required this.radAngle,
required this.width,
required this.height,
this.id,
this.destroyAnimation,
this.speed = 150,
this.damage = 1,
this.attackFrom = AttackFromEnum.ENEMY,
this.withCollision = true,
this.onDestroy,
LightingConfig? lightingConfig,
CollisionConfig? collision,
}) {
_loader.add(AssetToLoad(flyAnimation, (value) {
return this.flyAnimation = value;
}));
this.position = Vector2Rect(
position,
Vector2(width, height),
);
if (lightingConfig != null) setupLighting(lightingConfig);
setupCollision(
collision ??
CollisionConfig(
collisions: [
CollisionArea.rectangle(size: Size(width, height)),
],
),
);
_cosAngle = cos(radAngle);
_senAngle = sin(radAngle);
angle = radAngle + (pi / 2);
}