How do I make an instance follow player inputs exactly

0 favourites
  • 5 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • 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.

    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.

  • 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"

  • Thanks Toaster, that seems like it could work! I'll give it a try.

  • 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

    I wonder if there is a way to record the player input of a keyboard or gamepad and then playing that back.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I've done a few tests but there is still an issue.

    Look at this Capx example.

    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.

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