Ashley's 2017 article on delta-time says:
Don't forget behaviors already use dt. If you use behaviors to control all motion in your game, you don't have to worry about dt at all!
So, can I ignore delta-time when using the lerp function to position a sprite with the ScrollTo behavior? For context, see the comments in my code below:
const lerp = (start, stop, amount) => amount * (stop - start) + start;
export default class Game {
#runtime;
#camera;
#player;
start(runtime) {
this.#runtime = runtime;
this.#camera = this.#runtime.objects.Camera.getFirstPickedInstance();
this.#player = this.#runtime.objects.Player.getFirstPickedInstance();
this.#runtime.addEventListener('tick', () => this.#onTick());
}
#onTick() {
// Do I need `this.#runtime.dt` here?
// Or, does the scrollTo behavior already use it?
const amount = 0.3 * this.#runtime.dt;
// Move the camera to the player's position using lerp.
this.#camera.x = lerp(this.#camera.x, this.#player.x, amount);
this.#camera.y = lerp(this.#camera.y, this.#player.y, amount);
}
}