Hello!
Here is my problem:
I need to spawn a big hitbox for every enemy to have (its needed for detecting the player).
My problem is that I can’t figure out how to do it without having a lot of problems:
- the hitbox doesn’t rotate
- only one enemy gets a hitbox
- one hitbox switches between two enemies
- two hitboxes spawn for every player.
![image](https://forum.gdevelop.io/uploads/default/original/2X/2/253f5457622fdd15eec951d4129a8a8f7df98af5.png)
Flipping hitbox is because I need enemy to only detect player when enemy is facing him.
I would be very grateful if someone helps me out with this, I’ve tried a couple of solutions, but they failed… ![:confused: :confused:](https://forum.gdevelop.io/images/emoji/apple/confused.png?v=12)
(oh and Trigger Once isn’t usually the solution)
So while I’m not 100% sure on your issue, some basic info:
You absolutely want trigger once on your create object event at minimum. Else you’re creating infinite hitboxes for each grunt every frame.
Also, you have conflicting events. “Is horizontally flipped” is your condition, but then you’re also telling it to horizontally flip it on your events. and since you don’t have “trigger once” or other conditions on that, you’re going to constantly cause it to flip back and forth, basically.
I’ve tried setting up Trigger Once into different ways, but it never really gave me what I needed.
Also, “Is horizontally flipped” is for an enemy, and “Flip horizontally” is for a hitbox, there isn’t no conflict here (it just flips the hitbox when enemy changes direction)
why aren’t you create the hitbox object with the enemies? in the same event, where create the enemy? are you tried object linking? may be thats what are you looking for.
it is a top-down game or a side view?