mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 19:29:18 +00:00
Compare commits
No commits in common. "0cb994db0dd53fb8286e54ef1ae0cb668e085fb1" and "9109e3de9061a2e7103d203d43f4273bc8bf7d42" have entirely different histories.
0cb994db0d
...
9109e3de90
1 changed files with 2 additions and 13 deletions
15
README.md
15
README.md
|
@ -38,23 +38,12 @@ world:set(sara, Name, "sara")
|
||||||
|
|
||||||
print(getName(parent(sara)))
|
print(getName(parent(sara)))
|
||||||
|
|
||||||
for e, name in world:query(Name, pair(ChildOf, alice)) do
|
for e in world:query(pair(ChildOf, alice)) do
|
||||||
print(name, "is the child of alice")
|
print(getName(e), "is the child of alice")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Output
|
-- Output
|
||||||
-- "alice"
|
-- "alice"
|
||||||
-- bob is the child of alice
|
-- bob is the child of alice
|
||||||
-- sara is the child of alice
|
-- sara is the child of alice
|
||||||
|
|
||||||
local Position = world:component()
|
|
||||||
local Velocity = world:component()
|
|
||||||
|
|
||||||
local function things_move(world, dt)
|
|
||||||
for e, p, v in world:query(Position, Velocity) do
|
|
||||||
world:set(e, Position, p + v * dt)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
things_move(world, 1/60)
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue