Comp = { f = v } -> Comp { f: v }. record() requires ':' and parse_spawn()
drops the '=' before the record; '=' is now assignment/binding only. Records
appear only in games, so the compiler seed is unaffected.
Migration: tools/ludic-tools/migrate_records.c (spawn-context aware). Verified
every golden byte-identical, old '=' form rejected, reseeded, test.sh 14/14.
Docs updated (LANGUAGE.md, BOOTSTRAP.md R2).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
738 B
Text
34 lines
738 B
Text
# hello.ludic — smallest program that exercises the ECS pipeline
|
|
game Hello {
|
|
|
|
component Pos { x: int = 0, y: int = 0 }
|
|
component Vel { dx: int = 0, dy: int = 0 }
|
|
|
|
system Boot phase Start {
|
|
spawn Mob {
|
|
Pos { x: 3, y: 4 }
|
|
Vel { dx: 1, dy: 0 }
|
|
}
|
|
spawn Mob {
|
|
Pos { x: 10, y: 2 }
|
|
Vel { dx: 0, dy: 1 }
|
|
}
|
|
}
|
|
|
|
# a system can declare the entities it operates on: the body then runs once
|
|
# per match, with the components bound and self() giving that entity.
|
|
system Move phase FixedUpdate
|
|
query (p, v) [Pos, Vel]
|
|
{
|
|
p.x = p.x + v.dx
|
|
p.y = p.y + v.dy
|
|
}
|
|
|
|
system Report phase Update {
|
|
for (p) in query [Pos] {
|
|
print_int(p.x)
|
|
print_int(p.y)
|
|
}
|
|
quit()
|
|
}
|
|
}
|