Creating an object (hitbox) once for each enemy instance

I’m trying to create a “Weak Spot” hitbox on an enemy’s backside, which will stick to the enemy in that position at all times (on all frames). I want this spot to be the only way the enemy can be damaged.

So, to create the hitbox at the point I’ve set up in each animation of the enemy, it seems to make sense to use a For Each loop. However, I know that using a Trigger Once with a For Each produces unexpected results. But since I only want to create this hitbox object one time for each enemy at the designated point, I don’t see how this would be accomplished without using a Trigger Once at some point. Here is the code I’ve been playing with:

The problem with this code is that without a Trigger Once, it is creating the hitbox object over and over on every frame. If I add a Trigger Once, it will only create the hitbox on one instance of the enemy and not each of them.

So how would this work? How can I get this hitbox created one time for each instance of the enemy and get it to stay at the enemy’s designated point on every frame using a For Each without a Trigger Once? Thanks in advance.

Here’s how I created enemy health for the enemies in this game. Each enemy has a health link to it.

In your case, you can try replacing the “enemyHealth” with your weak spot object.


Thank you so much. This worked. I never really understood how the linking objects events worked, but I think I’m starting to get the hang of it now that I’m seeing it in action. Thank you for your information!

Awesome, glad i could help.

1 Like

As an alternative to linking 2 objects and moving the linked object by events, you can use the sticker extension. Stick the object onto another, and the extension will take care of object placement.

1 Like

Thank you for the suggestion, MrMen! I had heard of that extension, but I didn’t know that is what it was for. I guess I should have read more about it!