enemy attack the player

emojiemoji Member, BASIC Posts: 66

hello, and thank for all the help that I been getting.

based on the picture above my enemy is able to follow my player left or right but my enemy just stop once it reach my player but when i move again it follow my player and yes it is facing my player properly. my question is how can I get my enemy to do some action like punch my player instead of just stopping when reaching its destinaction. so from my enemy i can access my player xPos, yPos, the distance between my player & enemy and also I got vectorToAngle between player & enemy (using this as attribute I get my enemy to face left or right toward my enemy see picture)

Comments

  • emojiemoji Member, BASIC Posts: 66

    update, I figure it out. I just declare an attribute as enemyCanPunch and if the distance is <50 between two actors then I just set it to true. Also when my enemy moves left or right toward the player, I notice there is a little delay for it to move. How can I fix that so it faces the player without a small noticeable freeze?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I believe what you'd want instead of MoveTo is Change Velocity and then use a vectorToAngle expression to determine where to point.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.