Create copy of character with delay

I want to create a copy of the controllable character that replicates every move but the copy moves with a few seconds of delay, I would like to be able to modify this delay value at my will. Is there any simple way to create this object?

I would consider adding a boolean variable to the character object (say is_clone), and setting that to true for the duplicate character.

Turn off default controls on the character object if you have movement controlled by a behaviour, and use the simulate keypress instead. Then only apply the keypress immediately to the non-clone, and the delayed keypress to the clone.

You’ll have to store each key press. An array seems easiest, but can look weird if frame rates fluctuate.

Personally I’d look at a structure in conjunction with a timer (store the current timer value + delay as the key and the keypress as the value). The when the timer reaches the structure’s key value, execute the keypress stored. This allows for the delay to be changed during game play.

1 Like

This is similar to what i had thought but I expected a much simpler system that does not seem to exist XD

The fluctuation of timedelta() can avoid multiplying the array index by timedelta() to keep time coordinate. I can registry better the coordinates and anything else every frame better than keys pressed.

I expected a simple way but it’s ok Mr.Men, thank you very much.

I don’t see how you can use TimeDelta in this way, and I don’t think it will help in this case. If the game is running at 60fps, and suddenly drops to 30fps, how will it know to skip every second entry? TimeDelta is no use here.


Agreed, that would be a good method. Here’s a link to a thread covering a Braid like effect. It should be reasonably easy to modify that for your purpose .

1 Like