(Solved) Lots of shooting enemies

Hello everyone! I’m sorry that I constantly turn to the help of more experienced users, but I still haven’t figured out the logic and some of the functions of the engine. I describe the situation: there is a code that makes enemies move behind the player and at the same time change the animation depending on the angle of movement (the project is isometric). This code was shared with me by MrMen, for which I thank him very much - it works perfectly. Because of the result I want to see in the context of the WHOLE game, I had to add some conditions to this code (screenshot attached). In the case of enemies attacking in melee - everything works as it should, but there are also enemies attacking the player with spells at a distance - there is a problem here. There’s no way I can get them to do it. It is necessary that they stop following the player when the distance between them is reduced to a certain value (let’s say 200 pixels, which I did in the condition), but they also need to change the animation relative to the angle of movement of the player within these 200 pixels (naturally, the animation differs from the usual walking animation). Each ranged enemy must also start casting spells, upon completion of which lightning will spawn into the player’s position. Yesterday I managed to create such conditions, but they were very buggy, so I’m here to find the best way to do it. Summing up: it is necessary to create conditions under which many existing ranged enemies will cast spells at the player while he is at a certain distance from them, while the enemies must change the animation relative to the player’s position. I really hope that with my bad English I was able to explain everything correctly. I hope for your help!

Your event layout is a bit scrambled. I’ve mocked up how I think it should be. Try this :

1 Like

And again, thank you very much. And I applied your method and saw what I wanted. Unless I had to add a condition “Repeat for each instance of Wizard”, because as soon as the player is in the pursuit zone of one of the wizards, the others change the animation to the one set by the first one. Now everything works. I wanted to ask: now it is necessary that the wizard starts casting during the animation of the attack and at the end of it, lightning is spawned in the player’s position. Should I do this using timers, at the end of which these events will occur? Won’t they happen to all wizards at the same time?

Work out which frame you of the wizard animation you want to start the lightning, and use a condition to check the wizard’s current frame.

To time the casting of the lightning, use the animation has finished condition while also checking the wizard has the attack animation playing.

You may need to use a variable to indicate the lightning has been cast, because the animation finished playing will continue to return a true (or you change animation from attack to something else).


Yes, a set of these conditions also leads to the desired result. Now I have a great scheme for creating ranged enemies in an isometric project - thank you very much!

1 Like