npc follow player

Get help using Construct 2

Post » Tue Apr 22, 2014 2:49 am

Hello I would like to know how to have character follow the player. Please help thanks!!!
Posts: 3
Reputation: 431

Post » Tue Apr 22, 2014 10:31 pm

To do this, you could look at the path finding behavior. Your character will need to have a path finding behavior and will need to check its distance from player. If the player is outside of your acceptable distance, it should use the path finding behavior to get to the player. This is extremely simple and make use of the built in functions in Construct but the character will not follow the exact path of the player, it would just try to find the shortest available path.

If you want the character to follow the players moves exactly, you would need to record the exact path the player used. You could do this easily by dropping invisible helper objects at each point where the players direction changes. These objects would need to have an incremental number variable so the character could follow them in order. When the character collides with each helper, it records the number of the object and the object is then destroyed. A good way to learn how to do this is to look at the template in Construct for click to move. Open Construct, create a new project and look through the list of templates for click to move.
Posts: 331
Reputation: 7,712

Return to How do I....?

Who is online

Users browsing this forum: lolsuperscratch, RobertMKD, tarek2 and 9 guests