EnemyExtensions extension
Functions util to use in your Enemy
- on
Properties
- playerRect → Vector2Rect
-
Gets player position used how base in calculations
no setter
Methods
-
getAngleFomPlayer(
) → double - Get angle between enemy and player player as a base
-
getInverseAngleFomPlayer(
) → double - Get angle between enemy and player enemy position as a base
-
seeAndMoveToAttackRange(
{required dynamic positioned(Player), double radiusVision = 32, double? minDistanceFromPlayer, bool runOnlyVisibleInScreen = true}) → void - Checks whether the player is within range. If so, move to it.
-
seeAndMoveToPlayer(
{required dynamic closePlayer(Player), double radiusVision = 32, double margin = 10, bool runOnlyVisibleInScreen = true}) → void - Checks whether the player is within range. If so, move to it.
-
seePlayer(
{required dynamic observed(Player), VoidCallback? notObserved, double radiusVision = 32}) → void -
This method we notify when detect the player when enter in
radiusVision
configuration Method that bo used in update method. -
simpleAttackMelee(
{required double damage, required double height, required double width, int? id, int interval = 1000, bool withPush = false, double? sizePush, Direction? direction, Future< SpriteAnimation> ? animationRight, Future<SpriteAnimation> ? animationDown, Future<SpriteAnimation> ? animationLeft, Future<SpriteAnimation> ? animationUp, VoidCallback? execute}) → void - Execute simple attack melee using animation
-
simpleAttackRange(
{required Future< SpriteAnimation> animationRight, required Future<SpriteAnimation> animationLeft, required Future<SpriteAnimation> animationUp, required Future<SpriteAnimation> animationDown, required Future<SpriteAnimation> animationDestroy, required double width, required double height, int? id, double speed = 150, double damage = 1, Direction? direction, int interval = 1000, bool withCollision = true, bool enableDiagonal = true, CollisionConfig? collision, VoidCallback? destroy, VoidCallback? execute, LightingConfig? lightingConfig}) → void - Execute the ranged attack using a component with animation