Implement enemy sprite facing the correct way.

0 favourites
  • 6 posts
From the Asset Store
Fully animated four directional dungeon guards pack
  • I'm using the line of sight behavior to check if the player is within range, then I set the pathfinding behavior to find a path to players x and y every 0.5 seconds and move along path to player. I have animations for up down left and right for the enemy, but the problem is I have no idea how to get that enemy to face the correct direction as it moves towards the player. I have tried referencing the players angle but it doesn't seem to work. Any help would be appreciated.

  • Hello Ashburp ,

    I have the same problem , can you give me the Capx file for ( The line of sight behavior to check if the player is within range, then I set the pathfinding behavior to find a path to players x and y every 0.5 seconds and move along path to player )

    Please you can delete everything or what you want.

    It's for our school project, sorry that i can't help you.

    I hope you can help us.

    Salute,

    Sero

  • I think I may have figured it out on my way to work.

    while Enemey has line of sight ----> find path to player.x and player.y

    ----> move along path

    subevent

    while moving along path

    subevent

    enemy.x > player.x ---> then animate "left"

    enemy.x < player.x----> then anmate "right"

    else

    enemy.y> player.y +200 ---->animate "up"

    enemy.y< player.y -200 ---->animate "down"

    granted its kinda hokey and I may have the y positions kinda screwed up but in theory i think it might work or be kinda close. I don't know. I'll have to mess with it when I get home.

  • Thanks Ashburp ! , I will try this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • hey just got it working with one problem, the enemy doesn't face left. I'll fix it tonight and post a link to the dropbox tomorrow. also you have to do an every x seconds (under the system like every 0.5 seconds find path to player.X and player.Y) so the enemy will constantly find a path to the player.

  • okay here is the drop box link to the cap.x file

    https://www.dropbox.com/s/yht39ujggj3rb ... tHelp.capx

    should be under the frog enemy group

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)