Hello, I'm having an issue with creating enemies for my game, more specifically how they are animated. Since the enemies will have complex animations (running, firing their guns, standing still, etc) I created an enemy box to spawn and assign them to as I would for a player character. I gave the box the platform behavior so that it can be moved.
(the purple 'E' box in this screenshot)
The box has a variable called 'Direction' that controls which direction the box is facing, 'left' or 'right'. When the box collides with the GoLeft and GoRight boxes (the blue ones with arrows in the screenshot above), it turns around and goes the opposite way and sets 'Direction' to the new direction it is moving in.
What I want to have happen is, when the box is facing left, the sprite for the enemy (the dinosaur lookin' dude in the screenshot above) attached to the box is mirrored, and when it is facing right, the sprite is not mirrored (since they face right by default).
The trouble is that I have no idea how to accomplish that. Movement I have down pat; when I have multiple boxes they all move and correspond with the GoLeft/Right boxes properly. The sprites attached to them on the other hand, when I try to set them to be mirrored, do... er, this:
(oh god help I'm so lost here)
If you can't tell what's happening, the sprites are flipping around whenever ANY enemy box hits ANY GoLeft or GoRight box. Notice that the mirroring on the boxes behind the sprites is working totally fine.
So my question is: How do I make it so that, when a box changes direction, it ONLY affects the sprite pinned to it and not the others?