Skip to content

World and Entities

Giacomo Cavalieri edited this page Sep 30, 2021 · 10 revisions

A World is an Entities container. To create a World you can simply write:

object Example with ECScalaDSL {
  val world = World()
}

Once you have a World you can add an Entity to it with the following syntax:

object Example with ECScalaDSL {
  val world = World()
  val addedEntity = world hasAn entity
  // or val addedEntity = world.createEntity()
}

Entities can also be removed from the World they belong to:

object Example with ECScalaDSL {
  val world = World()
  val addedEntity = world hasAn entity
  remove (addedEntity) from world
  // or world removeEntity addedEntity
  // or world -= addedEntity
}
Clone this wiki locally