mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
1,003 B
1,003 B
World
A World contains entities which have components. The World is queryable and can be used to get entities with a specific set of components.
Functions
new()
function World.new(): World
Creates a new world.
Example: ::: code-group
local world = jecs.World.new()
import { World } from "@rbxts/jecs";
const world = new World();
:::
entity()
function World:entity(): Entity
Creates a new entity.
Example: ::: code-group
local entity = world:entity()
const entity = world.entity();
:::
component()`
function World:component<T>(): Entity<T>
Creates a new component.
Example: ::: code-group
local Health = world:component() :: jecs.Entity<number>
const Health = world.component<number>();
:::
::: info You should use this when creating components.
For example, a Health type should be created using this. :::