How do i create an object for each object and position them for each independent object?
What i mean is, im trying to make a sort of “Vision” hitbox for enemies and i want to when creating them, [im using a timer to create them very 1 sec] i also make the vision hitbox and put it specifically on each of them.
But, when i try doing it it just makes one on the same enemy’s position.
I have a few quetions because I don’t understand why there are some events or what your intention is for them:
What’s the point of these event conditions:
You are repeating 2-5 times, checking if the timer has run for at least a second, checking if there are less than 18 enemies in the scene and only doning this once. Then in the actions the timer is reset, rendering the conditions false anyway.
In the subevent, you pick all enemies, but only create an EnemyVision obejct with no reference to the enemy.
You iterate over each enemy, then pick a random one. That will only every pick the enemy you’re iterating over. In the actions, you link and position the EnemyVision to an enemy. You haven’t specified with EnemyVision in the conditions, and so I think it’ll link all EnemyVisions to the first Enemy.
You are best off to link an EnemyVision and Enemy at the point where they are both created. Try something along these lines instead:
The simplest way would be to use the Sticker behavior.
I would create all of the necessary EnemyVision objects at the beginning, or when new Enemy are created. Stick them to the Enemy, then if you want them to appear or disappear simply use the Show and Hide actions. There is a condition in the Sticker behavior “object is stuck to another” so there’s no need for links.
(sticker behavior goes to the EnemyVision, not the Enemy)
at the beginning of the scene
repeat for each Enemy | create EnemyVision at Enemy.X, Enemy.Y
| stick EnemyVision to Enemy
| hide EnemyVision
-------
Enemy is within 200 pixels of Player
(or whatever condition you want)
EnemyVision is stuck to Enemy | show EnemyVision