Hey, i've been having some problems with this, basically i have 1 player, and 1 or more "ghosts", and these ghosts replicate the player's movement.
In both, player and ghost, i'm using the latform behavior, simulating left, right, jump, when the player does too.
My current ideia is, i calculate the time it takes for the ghost to get to the position when the player performs an action. Lets say, when the player jumps, i call a function passing the player's X and Y as arguments, that loops(using for each) all ghosts, setting 2 instance varialbes to the ghosts X and Y, then i wait z seconds, where
z= distance(Function.Param(0), Function.Param(1), Ghost.X, Ghost.Y) / Ghost.Platform.Speed and then i simluate the jump on the ghost.
This doesn't work very well in a couple of scenarios, if i have multiple platforms, different Y levels, the ghosts start to derp. Also I have the Wrap behavior, soo if i jump while some ghosts are "wrapping" to the other side, these ones only jump after a while.
Any tips, maybe a new approach? Thanks in advance!
PS: the for each loop, does it run in parallel?