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", ]) })
// spawn a butterfly at random position every 1 second loop(1, () => { add([ sprite("butterfly"), pos(rand(vec2(width(), height()))), area(), "friend", ]) })