Rewind at 2× speed

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-23 21:43:24 -06:00
parent a631b0f0e2
commit f583fe3b10

View File

@ -661,7 +661,12 @@ class Player extends PrimaryView {
this.update_ui(); this.update_ui();
} }
} }
this._advance_handle = window.setTimeout(this._advance_bound, 1000 / TICS_PER_SECOND); let dt = 1000 / TICS_PER_SECOND;
if (this.state === 'rewinding') {
// Rewind faster than normal time
dt *= 0.5;
}
this._advance_handle = window.setTimeout(this._advance_bound, dt);
} }
// Redraws every frame, unless the game isn't running // Redraws every frame, unless the game isn't running