Skip to content
RedRimmedBox edited this page Apr 14, 2025 · 7 revisions

Usage

A System is defined as a pure function.

func yourSystem(
    commands: Commands,
    position: Query2<Entity, Position>,
    love: Query3<Heart, Memories, Trust>
) {
    // Your wonderful logic here
}

Then, simply connect this function to the World. Once connected, it will automatically run whenever World/update(_:) is called!

let world = World()
    .addSystem(.update, yourSystem(commands:position:love:))

world.setupWorld()

world.update(-1) // first frame (start up)
world.update(0) // 💕
world.update(1) // 💕
...
Clone this wiki locally