ludic/examples/hello.ludic
Orkuncakilkaya 985f9ad8f2 Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete
Self-hosted compiler (selfhost/*.ludic), runtime, examples, editor tooling,
and docs. Phase 1 of the syntax-redesign cohesion pass has landed:
edge-system fix, signature-query, when-alias, and the documentation truth-pass.
Suite green (14/14), C-free bootstrap fixpoint holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 15:15:35 +03:00

34 lines
754 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()
}
}