Hello. This is 2D related (working with 2D toolkit sprites).
I want to make an enemy follow the player. This is easy, with Move Towards action.
BUT, when the enemy faces left, I want to set its X scale to -1, to mirror it.
How can I update its X scale to mirror the sprite ?
I hope someone can tell me how to do this right.
My approach is FAR too complex:
I tried to do it with two FSM. One handles movement, and the other handles mirroring (with two global transitions, triggered by the movement-FSM).
But this way, events are sent every frame even if mirroring did not change.
The movement FSM compares X position with last frame's X (stored in xOld variable using a Get Position action as last state action). If x>xOld, we are looking right, and an event is sent to the mirroring-FSM. If x<xOld, looking left event is sent.
I tried to avoid calling mirroring-FSM every frame, by adding an aditional state in movement-FSM, but I got infinite looping (because I checked a bool variable to see if mirroring changed, and if it didn't, I went back to first state).
I'm an experienced programmer, but I just don't know how to use Playmaker with such a simple behaviour. I spent couple of hours before asking. I'd like to learn, so thanks in advance.