I want the NPC to face on where it’s currently moving. My NPC is currently facing left and I want to flip it horizontally when it starting to move to the right then vice versa. But the thing is what condition will I do to do it. My game is top - down so I cannot do collisions to something and the NPC is using the bounce behavior so I cannot use the wall because sometimes even if the NPC hit the wall it goes on its current direction again. Hope someone will help me. Thanks in advance!
I’m not very good, I still know the engine, but the logic suggests such options:
- if it is possible to catch the bounce event (if the object collided), then react to it;
- always check where the object is moving (compare the coordinates from the previous frame and the current one, or get the values of the direction of the force vector) and direct it in the required direction.
I’m a beginner in the engine, so I won’t tell you a specific “code” =)
Either, as @E1e5en suggested, by tracking the old x position and comparing it to the current x postion.
Or by using ForceAngle():
I use your events and the bottom condition works (Poop >= 90 and Poop < 270) but the top didn’t. I know this because I try to change the action that will happen and I change it to remove the NPC itself. When it moves to the left, the NPC was removed but right, it’s not. Hope you can help me again.
Yes, the top one is an OR, not an AND. So close
It works! Thank you!