mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 19:29:18 +00:00
Compare commits
2 commits
9109e3de90
...
0cb994db0d
Author | SHA1 | Date | |
---|---|---|---|
|
0cb994db0d | ||
|
a9cde98508 |
1 changed files with 13 additions and 2 deletions
15
README.md
15
README.md
|
@ -38,12 +38,23 @@ world:set(sara, Name, "sara")
|
|||
|
||||
print(getName(parent(sara)))
|
||||
|
||||
for e in world:query(pair(ChildOf, alice)) do
|
||||
print(getName(e), "is the child of alice")
|
||||
for e, name in world:query(Name, pair(ChildOf, alice)) do
|
||||
print(name, "is the child of alice")
|
||||
end
|
||||
|
||||
-- Output
|
||||
-- "alice"
|
||||
-- bob 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