lifespan(time: number, options?: LifespanCompOpt): EmptyComp

Destroy the game obj after certain amount of time

paramtime- The time to live.

paramoptions- Options for the lifespan component. See

// spawn an explosion, destroy after 1 seconds, start fading away after 0.5 second
add([
    sprite("explosion", { anim: "burst", }),
    lifespan(1, { fade: 0.5 }),
])

returnsThe lifespan comp.

sincev2000.0