Hi all,
Recently I got back to using Construct 2 and I am playing around with enemy AI. I am trying to create an enemy that basically does this:
- On spawn, it pathfinds to player.
- When it sees player it checks distance; if it is within attack range.
--- if yes, then attacks the player periodically (i.e. every x seconds based on its attack speed).
--- if no, then continue to pathfinds till it reaches its attack range.
- If player moves away (further than attack range) from the enemies, they go back to pathfinding towards the player.
Another thing I'd like to do is not have enemies overlap on each other when they reach the player (like you see them in the GIF below). I haven't addressed that yet, because I am not sure exactly how to do that in Construct 2.
This the event sheet:
i.imgur.com/FYmzmqh.png
This is the bahaviour I get:
i.imgur.com/fZ6wRxj.gif
First off they don't stop at the range I set in LoS (50) they stop RIGHT on top of the player. Second thing is that if I watch the player's HP to check the attacks, all I find is that the HP is being deducted as if one enemy is attacking. In the GIF there are 4 enemies (2 are overlapping each other) and yet when an attack happens HP goes down from say 10 to 8 instead of instantly to 2. Do I have to use a for loop for the attack?
Not sure what I am doing wrong exactly. Any ideas?
Thanks in advance.