How do i create an object for each object and position them on each object independently?

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.

Also, i would like to make it ALWAYS be on each enemy’s position, so like attached to it.

Thanks in advance.

I have a few quetions because I don’t understand why there are some events or what your intention is for them:

  1. What’s the point of these event conditions:
    image
    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.

  2. In the subevent, you pick all enemies, but only create an EnemyVision obejct with no reference to the enemy.

  3. This event also makes no sense:


    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:




Better still, use the Sticker extension and stick the EnemyVision to the Enemy. That way each EnemyVision will move with the enemy object. Here’s a link on how to use the Sticker extension.

As simple as

This is for health bars but will work for what you want

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

@Hitbox, there a common theme happening here…

[For your first reply] The first two events were just to make enemies and visions so yeah. And also because im kinda dum. Thanks for the help!