How do I make a NPC follow the main player

0 favourites
  • 10 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I'm creating a prototype game where a NPC with follow the main player.

    I have found some solutions but there are some that I can't figure out.

    The main problem is that when the main player jump through a hole, the following NPC should jump as well but it's necessary a delay of x seconds or else the NPC will fall into the hole.

    I hope you guys get what I trying to say. Here is the game and the capx.

    https://dl.dropbox.com/u/89812940/followin/index.html

    CAPS ? https://dl.dropbox.com/u/89812940/followin/following.capx

    thanks,

  • You can pin him in rope style.

  • TELLES0808

    Can you please elaborate on it?

  • http://www.scirra.com/manual/99/pin

    The pin behavior

  • It didn't work. The following object is not at the platform anymore. It's floating in the air.

    When I add the platform to the NPC it doesn't fall in the hole anymore. It kind of float as well.

  • Download the demo from the footer - it has characters that follow you, open up the Capx. :)

    It's what I'm working on gameplaywise for this

  • Download the demo from the footer - it has characters that follow you, open up the Capx. :)

    It's what I'm working on gameplaywise for this

    The red character follows the green one across holes and jumps, without the need for placing markers or doing anything special other than placing solid/jump-thru blocks.

    The player and the NPC both have platform behaviour and similar speeds/jump, so the red character can follow wherever the green one goes.

  • JohnnySix You example is close to what I need but still find bugs in it.

    I played the game you are building and the NPC fell in the hole even though the main player didn't.

    Also, the NPC shouldn't die because it has no interaction in the game.

    Thanks anyways. I will keep trying.

  • TELLES0808

    Can you please elaborate on it?

    Just make it Pin as Rope, look inside the pin chain style to see the behavior in action.

    You can also work with the conditionals to unpin him when necessary and make him walk around, etc.

    I did it by this way and on another way.

    The second way is very much complex, but give you flawless results. You'll need to work with conditionals and make a very smart AI.

    Download the sandbox on my signature to see how I implemented the detectors for various situations. After it, I did an Artificial Intelligence, where the NPC will detect if he is overlapping an area around the player, if not, detect the best path to reach the player, and the detectors are made to setup the animations necessary for various situations, like in a climb, edge, cave, underwater, etc.

    I think you can just make a circle and try improve the pin in chain style for your game. If you don't know how to setup him fall back to the ground, just unpin him, and the behavior will do the rest, them, pin again. Check left, right, and setup the right animation for each situation, also, check if the player is mirrored, and if the follower is on the left or right of the player, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • JohnnySix, Where is the .capx you are talking about? Cause your follow mechanic is exactly what I need for my college game project. Any help in this regard would be greatly appreciated.

    Thanks

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