update(dt) {
		// play/pause video if necessary
		if (this.isVideo) {
			if (this.animationpause) {
				this.image.pause();
			} else if (this.image.paused) {
				this.image.play();
			}
			this.isDirty = !this.image.paused;
		} else {
			// Update animation if necessary
			if (!this.animationpause && this.current.length > 1) {
				let duration = this.getAnimationFrameObjectByIndex(
					this.current.idx,
				).delay;
				this.dt += dt;
				while (this.dt >= duration) {
					this.isDirty = true;
					this.dt -= duration;

					const nextFrame =
						this.current.length > 1 ? this.current.idx + 1 : this.current.idx;
					this.setAnimationFrame(nextFrame);

					// Switch animation if we reach the end of the strip and a callback is defined
					if (this.current.idx === 0) {
						if (typeof this.onended === "function") {
							this.onended();
						}
						if (typeof this.resetAnim === "function") {
							// Otherwise is must be callable
							if (this.resetAnim() === false) {
								// Reset to last frame
								this.setAnimationFrame(this.current.length - 1);

								// Bail early without skipping any more frames.
								this.dt %= duration;
								break;
							}
						}
					}
					// Get next frame duration
					duration = this.getAnimationFrameObjectByIndex(
						this.current.idx,
					).delay;
				}
			}
		}

		//update the "flickering" state if necessary
		if (this._flicker.isFlickering) {
			this._flicker.duration -= dt;
			if (this._flicker.duration < 0) {
				if (typeof this._flicker.callback === "function") {
					this._flicker.callback();
				}
				this.flicker(-1);
			}
			this.isDirty = true;
		}

		return super.update(dt);
	}
update function. <br>
automatically called by the game manager {@link game}
@protected
@param {number} dt - time since the last update in milliseconds.
@returns {boolean} true if the Sprite is dirty