__update()

in libs/game/sprite.ts [468:500]


    __update(camera: scene.Camera, dt: number) {
        if (this.lifespan !== undefined) {
            this.lifespan -= dt * 1000;
            if (this.lifespan <= 0) {
                this.lifespan = undefined;
                this.destroy();
            }
        }
        if ((this.flags & sprites.Flag.AutoDestroy)
            && this.isOutOfScreen(camera)) {
            this.destroy()
        }

        if (this.flags & sprites.Flag.StayInScreen) {
            if (this.left < camera.offsetX) {
                this.left = camera.offsetX;
            }
            else if (this.right > camera.offsetX + screen.width) {
                this.right = camera.offsetX + screen.width;
            }

            if (this.top < camera.offsetY) {
                this.top = camera.offsetY;
            }
            else if (this.bottom > camera.offsetY + screen.height) {
                this.bottom = camera.offsetY + screen.height;
            }
        }
        // Say text
        if (this.updateSay) {
            this.updateSay(dt, camera);
        }
    }