Skip to content

World and Entities

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

A World is an entities container.

Creating a world

To create a World you can simply write:

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

Adding entities to a 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()
}

Removing entities from a world

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