(Solved) How do i make an enemy charge attack?

Hey there! im trying to make a enemy attack that rely on this sentence

-Enemy follows the player

-When reach some distance to player, the enemy stop following the player for x second

-The enemy charge toward enemy position

This is what i made

This enemy follows the player, when colission with the HITBOX_PLAYER, it stop and make an attack animation on place inside the “attack” timer, so it last 1 second on place.

Now i need to add the charge sentence (enemy throws itself to the player), im trying with force but i cant reach the goal that i want.

-The hitbox follows the player position, so if i dodge and and the enemy is no longer inside the hitbox i want it to continue with the charge attack.
-When i use force to an object or position (player), the enemy will try to charge but until the position of the object, how enemy can pass trough the player? for example a charge attack with 200 pixels long with direction to the player.

Is there a better behavior to do this?

You could

Put here whatever you need when enemy is ready to launch toward player

Apply force toward object (player in this case)

Now next event
Enemy is in collision with player

Remove all forces from enemy
Play WHATEVER animation you want

hey, hi for response!

I tried this, but the enemy stop at player position.

Im looking for something similar to this, but in a topdown visual:
(not exactly what i want but is closest example that i could found)

I was sure you want something like

Player is in some distance to enemy
Enemy moves toward player with accelerated speed and when he is next to him he perform attack like throw a punch
Or to be exact like shooting arrow into target

Instead you want enemy to become human cannon ball which pass trough player?
If so then
Again whatever you want here when enemy is ready to charge

Change animation of enemy to charge attack
Apply force to enemy toward player

Another event
Enemy in collision with player

WAIT 0.5 sec (change how long to your needs)
Remove all forces from enemy

This seems to work, i made when enemy distance from player is below 100 pixel, apply the force and wait.

But this doesnt work with the movement function (pathfinder behavior)

Is there a way to stop enemy movement when the enemy reach a distance of 100 pixels to player?

In event where you start applying the force
Above action where you apply the force you put this action
Just specify what behavior you wanna disable

And be aware if you want to enable pahtfinding again you need to activate it again via another evnet
For example if distance to player is above 100 pixels

1 Like

Thanks! now the basics are working, i have to add some effects and order some lines and i think it will work like i want :smiley:

1 Like