Skip to content

scheduler

scheduler(): Scheduler

Defined in: src/scheduler.ts:322

Returns a new Scheduler, the starting point of a game made with Toucan.

Responsible for running systems, building plugins and organizing phases.

@example*

const Person = component()
const Age = component<number>()
function spawnPeople() {
entity('Alice').set(Age, 25)
entity('Bob').set(Age, 30)
}
const greetPeople = query(Age).with(Person).bind((entity, age) => {
print(`Hello, ${entity}! I can magically sense that you're ${age} years old!`)
})
scheduler()
.useSystem(spawnPeople, STARTUP)
.useSystem(greetPeople, UPDATE)
.run()

Scheduler