Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. 🎮 Your friendly TypeScript 2D game engine for the web 🗡️ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536import type { Action } from '../action';import { nextActionId } from '../action';
export class Delay implements Action { id = nextActionId(); private _elapsedTime: number = 0; private _delay: number; private _started: boolean = false; private _stopped = false; constructor(duration: number) { this._delay = duration; }
public update(elapsed: number): void { if (!this._started) { this._started = true; }
this._elapsedTime += elapsed; }
isComplete(): boolean { return this._stopped || this._elapsedTime >= this._delay; }
public stop(): void { this._stopped = true; }
reset(): void { this._elapsedTime = 0; this._started = false; this._stopped = false; }}