NPC mimic player movement.

For questions about using Classic.

Post » Sat Jun 23, 2012 4:33 am

Hey Guys!

Not even near this point of the game design but I wanted to ask now incase I do decide to use it for something else.

I am working on a 2d platformer - I want an NPC to follow my movement to the end of the level but I want it to be delayed. Examples of this are Ninja Gaiden and Ninja Spirit to name a couple.

I know it has something to do with actually controlling the npc with a lag in the controls but I'm not sure how to go about this in construct.

Off the top of my head I think of getting the angle, animation, speed etc. from the main player sprite and putting a timer on it... but I can see that causing a stutter. Maybe using a bullet behavior to control the npc?

Thanks for the help in advance! I'm loving making this game - too bad I can only do it between 8pm and 2am...

DMM


B
45
S
12
G
7
Posts: 339
Reputation: 7,899

Post » Sat Jun 23, 2012 2:16 pm

There were some examples of how to do the "braid" thing (recording the player for later replay, just don't use it reversed), could help here as well. Just look for "braid" or "braid-like".
Basically, sample the player's spatial data at fixed intervals (store them in s or an array or a hash table) then apply it to the npc with a delay.

EDIT: Don't know exactly what you mean by stutter, but in case it means the npc could move with sharp transitions, you can work against that using lerp.tulamide2012-06-23 14:18:02
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 23, 2012 4:11 pm

Thank you kindly! I'll look into it!! I don't remember if I've ever checked that game out or not...
B
45
S
12
G
7
Posts: 339
Reputation: 7,899


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests