How do I make a NPC follow the main player

Get help using Construct 2

Post » Mon Aug 13, 2012 5:23 pm

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,jogosgratispro2012-08-13 17:24:17
B
85
S
31
G
22
Posts: 384
Reputation: 18,587

Post » Mon Aug 13, 2012 5:24 pm

You can pin him in rope style.TELLES08082012-08-13 17:24:57
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Mon Aug 13, 2012 5:32 pm

@TELLES0808

Can you please elaborate on it?
B
85
S
31
G
22
Posts: 384
Reputation: 18,587

Post » Mon Aug 13, 2012 5:48 pm

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

The pin behaviorArcadEd2012-08-13 17:49:17
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Mon Aug 13, 2012 7:12 pm

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.
jogosgratispro2012-08-13 19:22:08
B
85
S
31
G
22
Posts: 384
Reputation: 18,587

Post » Mon Aug 13, 2012 10:13 pm

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
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Mon Aug 13, 2012 10:14 pm

[QUOTE=JohnnySix] 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[/QUOTE]

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.
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Mon Aug 13, 2012 10:27 pm

@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.
B
85
S
31
G
22
Posts: 384
Reputation: 18,587

Post » Mon Aug 13, 2012 10:30 pm

[QUOTE=jogosgratispro] @TELLES0808

Can you please elaborate on it?[/QUOTE]

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.
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Tue Mar 12, 2013 2:42 pm

@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
B
2
Posts: 2
Reputation: 254

Next

Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 32 guests