TextDamageComponent constructor
TextDamageComponent(})
Implementation
TextDamageComponent(
String text,
Vector2 position, {
this.onlyUp = false,
TextStyle? config,
double initVelocityTop = -4,
this.maxDownSize = 20,
this.gravity = 0.5,
this.direction = DirectionTextDamage.RANDOM,
}) : super(
text: text,
textRenderer: TextPaint(
style: config,
),
position: position,
) {
_initialY = position.y;
_velocity = initVelocityTop;
switch (direction) {
case DirectionTextDamage.LEFT:
_moveAxisX = 1;
break;
case DirectionTextDamage.RIGHT:
_moveAxisX = -1;
break;
case DirectionTextDamage.RANDOM:
_moveAxisX = Random().nextInt(100) % 2 == 0 ? -1 : 1;
break;
case DirectionTextDamage.NONE:
break;
}
}