Cycles before sprite self removal.
Usually set before the draw()
cycle to initiate a countdown. sprite.lifetime is reduced by 1 in every draw()
cycle. At 0 it will call a sprite.remove()
. Default value is -1 which disables the lifetime for that sprite.
var sprite = createSprite(200, 200); sprite.lifetime=50; function draw() { background("white"); drawSprites(); }
sprite.lifetime
The lifetime of the sprite.
drawSprites()
is called.Found a bug in the documentation? Let us know at documentation@code.org