@@ -30,7 +30,7 @@ Read our [Quickstart guide](https://docs.mineinabyss.com/geary/quickstart/) to s
3030data class Position (var x : Double , var y : Double )
3131data class Velocity (var x : Double , var y : Double )
3232
33- fun Geary .updatePositionSystem () = system(query<Position , Velocity >())
33+ fun WorldScoped .updatePositionSystem () = system(query<Position , Velocity >())
3434 .every(interval = 20 .milliseconds)
3535 .exec { (position, velocity) ->
3636 // We can access our components like regular variables!
@@ -41,22 +41,27 @@ fun Geary.updatePositionSystem() = system(query<Position, Velocity>())
4141
4242fun main () {
4343 // Set up geary
44- geary(ArchetypeEngineModule ) {
44+ val world = geary(ArchetypeEngineModule () ) {
4545 // example engine configuration
4646 install(Prefabs )
4747 }
4848
49- val posSystem = geary.updatePositionSystem()
49+ with (world) {
50+ // Create our system
51+ val posSystem = updatePositionSystem()
5052
51- // Create an entity the system can run on
52- entity {
53- setAll(Position (0.0 , 0.0 ), Velocity (1.0 , 0.0 ))
53+ // Create an entity the system can run on
54+ entity {
55+ setAll(Position (0.0 , 0.0 ), Velocity (1.0 , 0.0 ))
56+ }
57+
58+ posSystem.tick() // exec just this system
59+ tick() // exec all registered repeating systems, interval used to calculate every n ticks to run
60+
61+ val positions: List <Position > = posSystem.map { (pos) -> pos }
5462 }
55-
56- posSystem.tick() // exec just this system
57- geary.engine.tick() // exec all registered repeating systems, interval used to calculate every n ticks to run
58-
59- val positions: List <Position > = posSystem.map { (pos) -> pos }
63+
64+ world.close() // Use world.newScope(), then close to separate groups of systems into modules
6065}
6166
6267```
0 commit comments