help with enemy follow sprite

Get help using Construct 2

Post » Wed Dec 25, 2013 2:27 am


can any one help me with this i can't get enemy to change moving direction when passed by player.




https://www.dropbox.com/s/vayf3rj2syawqq8/help%20please.capx
B
8
S
2
Posts: 54
Reputation: 1,001

Post » Wed Dec 25, 2013 3:38 am

@etaprime

When you use mirrored, it changes the angle of the sprite, so it changes the LOS too. In your example, if you remove 'set Mirrored" and add a event "simulate pressing Left", it works.

I made this, I hope is what you need:
https://dl.dropboxusercontent.com/u/245537981/follow-example.capx

It basically does this:

If the X position of badGuy is less then the player X, then the player is in the front of the badGuy. So, "not mirrored". If it is greater, then the player is at the back of badGuy, then I "mirrored" the image.

Then I check if badGuy as a line of sight of the player. If yes, then I make another check to see if badGuy's X is less than or greater than player's X, and move accordingly.

I hope this helps. Martiny2013-12-25 03:51:54
B
7
S
1
Posts: 15
Reputation: 589


Return to How do I....?

Who is online

Users browsing this forum: plinkie, Syazanie Amirin, Yahoo [Bot] and 4 guests