lifespan(time: number, options?: LifespanCompOpt): EmptyComp
Destroy the game obj after certain amount of time
param
time- The time to live.
param
options- Options for the lifespan component. See
// spawn an explosion, destroy after 1.5 seconds (time + fade)
add([
sprite("explosion", { anim: "burst", }),
lifespan(1, {
fade: 0.5 // it start fading 0.5 second after time
}),
]);
returns
The lifespan comp.
since
v2000.0
group
Components