How do I make an instance follow player inputs exactly

Get help using Construct 2

Post » Fri Sep 11, 2015 2:13 pm

I need a way to let an instance i just created then match what the player is doing.
When the player moves the instance moves but I need to set an offset or a distance from the point.
But if the player waves the instance waves immediately.
Basically what I'm trying to re create is something along the lines of the "Ghosts" of the player in the game Ninja Gaiden.
So when player jumps and runs then jumps, the instance a half second later jumps then runs then jumps.
Another small twist is that when the player stops moving so does the instance...even in mid air.

You can see what I mean 0:35 seconds in on this video.
https://youtu.be/M8beT4d7HIw?t=35s

One can obviously use "Set to position" and set the position of the instance to the player after spawn but that then only jumps there. it's not a smooth transition.
One can probably do some sort of Simulate control but how would you do the wave or a shoot at the same time.

So as you can see i'm not 100% sure how to approach the problem. Any behaviors that would perhaps help make it easier?

Any help would be greatly appreciated.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Fri Sep 11, 2015 2:30 pm

Bumping as I also might need this in a future project but I also have an idea that could work.

Give both the player and the shadow the same platform behavior, but disable the standard controls on the enemy one. The player moves right instantly when you press "right" and for the enemy you do the following (for each button):

Is button "right" beeing pressed > Wait: X Seconds - Simulate input "right"

This should delay the shadows input and make it follow the player in the exact same motions. For the waving you simply leave out the "wait"
B
16
S
3
Posts: 69
Reputation: 1,048

Post » Fri Sep 11, 2015 5:51 pm

Thanks Toaster, that seems like it could work! I'll give it a try.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Sat Sep 12, 2015 11:48 am

So it works, kinda.
The enemy follows the commands but obviously not at exact place the player did.
I'm wondering if this is not actually solvable with an array to record movements but I'm kinda clueless about them at this stage.
It cant be too difficultas hey did this in 1988 :mrgreen:

I wonder if there is a way to record the player input of a keyboard or gamepad and then playing that back.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Mon Sep 14, 2015 11:42 am

So I've done a few tests but there is still an issue.

Look at this Capx example.
http://1drv.ms/1Mmllhl

You will see that whenever the player collides with an obstacle there is a problem then simulating the jump for instance as it was still continuing closer to the player object.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863


Return to How do I....?

Who is online

Users browsing this forum: vutankhoa2015 and 25 guests