Implement enemy sprite facing the correct way.

Get help using Construct 2

Post » Tue Mar 25, 2014 6:50 pm

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.
B
8
S
2
Posts: 38
Reputation: 626

Post » Tue Mar 25, 2014 7:06 pm

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
B
11
S
2
G
1
Posts: 27
Reputation: 692

Post » Tue Mar 25, 2014 8:22 pm

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.
B
8
S
2
Posts: 38
Reputation: 626

Post » Tue Mar 25, 2014 10:25 pm

Thanks Ashburp ! , I will try this.
B
11
S
2
G
1
Posts: 27
Reputation: 692

Post » Wed Mar 26, 2014 2:39 am

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.
B
8
S
2
Posts: 38
Reputation: 626

Post » Wed Mar 26, 2014 8:38 am

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
B
8
S
2
Posts: 38
Reputation: 626


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests