Hi, I have a problem, because in my game enemies are generated randomly (below I send how it works) and I would like to add something like EnemyVision, but I have no idea how to do it, so that the game generates e.g. 15 enemies and so that each of them has an object called EnemyVision (in short, so that EnemyVision always generates as many times as there are enemies)
The idea is that if, for example, 15 rats are generated, then the same amount of EnemyVision will be generated as the number of rats, and EnemyVision will be connected to each rat separately (When I used your actions, the fps in games dropped to 5)
Press middle mouse button until you see Attack Mode in top left
Then you hit RMB to to create slimes
And LMB to attack
Each of them will get a bar as soon as their HP is not 100%
And there is no lag to it at all
And you can even download project file to check it out
And it uses same events from screenshot i provided in previous message
I would like every generated enemy to have the Enemy Vision object, but only one enemy does

You’re deleting the spawn object, and then creating something at it’s position. But it’s deleted, so GDevelop doesn’t know where to place it.
Every time a rat is created, create an EnemyVision object for the rat and position it at the rat’s position (not the deleted spawn object).
I’d recommend you use the Sticker extension and stick the EnemyVision to the rat (here’s an older post on how to do this). As the rat moves and rotates, so does the EnemyVision that’s attached to it. No need to find the EnemyVision linked to a rat and reposition it.
Seriously, thank you, I didn’t even notice that I was deleting the spawn object
In the first event of you screen shot, add an “EnemyVision is stuck to Rat” condition. Otherwise the move action is applied to all rats, as you’ve experienced.
Also, stick the EnemyVision to the enemy as soon as the enemy and EnemyVision are created, so the each EnemyVision is stuck to the correct enemy:
And finally, keep that “
Delete SpawnObject” after each “Stick EnemyVision to ...” action. It’ll prevent a SpawnObject being selected multiple times.
Could you please help me make it so that after killing e.g. a rat only its EnemyVision is removed?
In the event with the conditions to select the Rat, add the condition “EnemyVision is stuck to Rat”, and delete the EnemyVision when the Rat is deleted.
Ideally you’d put all the enemy objects into an Object Group, and reference that instead of each object type.
Okay, thanks for your help
You delete it, in the same event where you delete the enemy (the one with the blue dash outline). You got the list when you selected all the EnemyVision objects that belong dead Enemies.
In the actions, first unstick the EnemyVision and then do the deletion of Enemy and EnemyVision.





