enemy follow and face player

emojiemoji Member, BASIC Posts: 66
edited July 2018 in Working with GS (Mac)

Hi all, I this question which I'm not sure how to handle so please help. As of now, I have my enemy follow my player and it works great but if my player were to move forward, my enemy also follows but the problem is it does not turn its face toward the player. How do I have my enemy face follow the enemy? I appreciate any help!

Comments

  • Two.ETwo.E Member Posts: 599

    You need to constrain the enemies rotation:

    You will need to constrain the Players X and Y positions to game attributes if you haven't already.

    In your enemy Actor:

    You need a constrain behaviour to constrain the rotation attribute.

    You want to use the vector to angle function.

    Function = vectortoangle(player.X - enemy.X, player.Y - enemy.Y)

    Best,

Sign In or Register to comment.