docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
19fcf60599
commit
a476ec7976
79 changed files with 481 additions and 355 deletions
|
|
@ -13,18 +13,20 @@ A <code>var</code> declares a <b>mutable</b> binding: unlike `let`, you may reas
|
|||
|
||||
```ludic
|
||||
program Scorekeeper {
|
||||
var score: int = 0
|
||||
var elapsed_frames: int = 0
|
||||
|
||||
handler Tick phase Update {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
if elapsed_frames % 60 == 0 { score = score + 1 }
|
||||
state ScorekeeperState {
|
||||
score: int = 0
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
handler Tick(scorekeeper_st: mut ScorekeeperState) phase Update {
|
||||
scorekeeper_st.elapsed_frames = scorekeeper_st.elapsed_frames + 1
|
||||
if scorekeeper_st.elapsed_frames % 60 == 0 { scorekeeper_st.score = scorekeeper_st.score + 1 }
|
||||
}
|
||||
|
||||
handler DrawWorld(scorekeeper_st: ScorekeeperState) phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_text(x: 6, y: 4, text: "SCORE", color: Color.White, scale: 1)
|
||||
Screen.draw_number(x: 52, y: 4, value: score, color: Color.Gold, scale: 1)
|
||||
Screen.draw_number(x: 52, y: 4, value: scorekeeper_st.score, color: Color.Gold, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue