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
|
|
@ -15,18 +15,20 @@ order: 0
|
|||
program EventExample {
|
||||
event EnemyDefeated { points: int = 0 }
|
||||
|
||||
var score: int = 0
|
||||
state EventExampleState {
|
||||
score: int = 0
|
||||
}
|
||||
|
||||
@On(EnemyDefeated) handler AddScore { score = score + points }
|
||||
@On(EnemyDefeated) handler AddScore(event_example_st: mut EventExampleState) { event_example_st.score = event_example_st.score + points }
|
||||
@On(EnemyDefeated) handler PlayChime { Screen.status("enemy down") }
|
||||
|
||||
handler ScoreOnKey phase Update {
|
||||
if Input.key() == 'k' { emit EnemyDefeated(points: 10) }
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
handler DrawWorld(event_example_st: EventExampleState) phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_number(x: 4, y: 4, value: score, color: Color.Gold, scale: 1)
|
||||
Screen.draw_number(x: 4, y: 4, value: event_example_st.score, color: Color.Gold, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue