loop(t: number, action: ()=>void): KEventController

Run the callback every n seconds.
// spawn a butterfly at random position every 1 second
loop(1, () => {
    add([
        sprite("butterfly"),
        pos(rand(vec2(width(), height()))),
        area(),
        "friend",
    ])
})
kaplay logo

3001.0.0-alpha.18

Misc