lifespan

Sets how many seconds this collider will exist for (it's lifespan), will .remove() itself at end of lifespan. Default value is null.

Examples


const sampleGroup = $.makeGroup();

function update() {
    if(sampleGroup.length<1) {
        const temp = $.makeBoxCollider($.w/2,2,20,20);
        temp.direction = 180;
        temp.speed = 2;
        temp.lifespan = 3;
    }
    sampleGroup.draw();
}