Making a object move away from another if a variable is too low

Hi, I am making a game where you are a circle and there is circle enemies that can collect other “circle parts”. And as they collect them, their strength increases (Same applies to the player too…). And if their strength is close or greater and is near to the player, They will attack the player or else they will run away and try to collect more “circle parts”. And I am facing a problem, It does not work. The enemy ignores the strength and always attacks the player, and if it far from the player, it stays still and not collect any “circle parts”. I tried many itterations, nothing works. To me the script looks that it should work fine, but it doesn’t.

Here is the script:

PS: I know I am making a lot of threads about this game and it’s issues. The thing is that I can’t find a way to fix it and also I am making this for a jam and I only have one day left and I haven’t completed majority of the work. I was supposed to finish this part two days ago, but I couldn’t

Thanks you so much for the help <3 <3

Try wrapping your events inside a “for each enemy_core”.
It should fix it, but if it doesn’t, converting the events to a function should help.
But if you’re not used to functions and your jam ends tomorrow… good luck. :sweat_smile:

1 Like