EnemyExtensions extension
Functions util to use in your Enemy
- on
Methods
-
seeAndMoveToAttackRange(
{required dynamic positioned(Player), VoidCallback? notObserved, VoidCallback? observed, double radiusVision = 32, double? visionAngle, double? angle, double? minDistanceFromPlayer, bool runOnlyVisibleInScreen = true}) → void -
Checks whether the player is within range. If so, move to it.
visionAngle
in radiansangle
in radians. is automatically picked up using the component's direction. -
simpleAttackMelee(
{required double damage, required Vector2 size, int? id, int interval = 1000, bool withPush = false, double? sizePush, Direction? direction, Future< SpriteAnimation> ? animationRight, VoidCallback? execute, Vector2? centerOffset}) → void - Execute simple attack melee using animation
-
simpleAttackRange(
{required Future< SpriteAnimation> animationRight, required Future<SpriteAnimation> animationDestroy, required Vector2 size, Vector2? destroySize, int? id, double speed = 150, double damage = 1, Direction? direction, int interval = 1000, bool withCollision = true, bool enableDiagonal = true, CollisionConfig? collision, VoidCallback? onDestroy, VoidCallback? execute, LightingConfig? lightingConfig}) → void - Execute the ranged attack using a component with animation