Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+2)

The way the time travel works is through a few scripts:

RecordedPlayerInput: A struct that contains 3 variables - Horizontal Input, Jump Input, Time Travel Input
TimeTravelRecorder: Component on the player. It has a RecordedPlayerInput list. A new element is added to that list every frame in FixedUpdate with the relevant inputs. When the player time travels, the script sends the list to the TimeTravelManager.
TimeTravelManager: Has all the copies of the player inputs and sends them to a player copy in Start.
PlayerCopy: Has a full list of RecordedPlayerInput that was sent from the TimeTravelManager in the Start function. Every fixed frame, the velocity is set according to the input of the current RecordedPlayerInput.

I don't know if I explained that well but hopefully it made a little sense.

(+1)

ahh i see. im not too familiar with structs but that makes sense for the most part