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
|
|
@ -16,11 +16,13 @@ program EnterHookExample {
|
|||
property Position { column: int = 0, row: int = 0 }
|
||||
model Player { Position }
|
||||
|
||||
var score: int = 0
|
||||
state EnterHookExampleState {
|
||||
score: int = 0
|
||||
}
|
||||
|
||||
scene Overworld start {
|
||||
on enter {
|
||||
score = 0
|
||||
on enter (enter_hook_example_st: mut EnterHookExampleState) {
|
||||
enter_hook_example_st.score = 0
|
||||
spawn Player { Position { column: 5, row: 5 } }
|
||||
}
|
||||
layer World {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ program LayerExample {
|
|||
property Position { column: int = 0, row: int = 0 }
|
||||
model Player { Position }
|
||||
|
||||
var score: int = 0
|
||||
let score: int = 0
|
||||
|
||||
scene Overworld start {
|
||||
on enter { spawn Player { Position { column: 6, row: 6 } } }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ program SceneHookExample {
|
|||
property Position { column: int = 0, row: int = 0 }
|
||||
model Enemy { Position }
|
||||
|
||||
var elapsed_frames: int = 0
|
||||
state SceneHookExampleState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
scene Overworld start {
|
||||
layer World {
|
||||
|
|
@ -31,8 +33,8 @@ program SceneHookExample {
|
|||
}
|
||||
|
||||
scene Battle {
|
||||
on enter {
|
||||
elapsed_frames = 0
|
||||
on enter (scene_hook_example_st: mut SceneHookExampleState) {
|
||||
scene_hook_example_st.elapsed_frames = 0
|
||||
spawn Enemy { Position { column: 8, row: 4 } }
|
||||
}
|
||||
on exit {
|
||||
|
|
|
|||
|
|
@ -13,13 +13,15 @@ A `scene` is one of the mutually-exclusive states a game moves between — a tit
|
|||
|
||||
```ludic
|
||||
program SceneExample {
|
||||
var elapsed_frames: int = 0
|
||||
state SceneExampleState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
scene Title start {
|
||||
on enter { elapsed_frames = 0 }
|
||||
on enter (scene_example_st: mut SceneExampleState) { scene_example_st.elapsed_frames = 0 }
|
||||
layer Main {
|
||||
handler WaitForStart phase Update {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
handler WaitForStart(scene_example_st: mut SceneExampleState) phase Update {
|
||||
scene_example_st.elapsed_frames = scene_example_st.elapsed_frames + 1
|
||||
if Input.key() != 0 { become Overworld }
|
||||
}
|
||||
handler DrawTitle phase Render {
|
||||
|
|
@ -31,7 +33,7 @@ program SceneExample {
|
|||
}
|
||||
|
||||
scene Overworld {
|
||||
on enter { elapsed_frames = 0 }
|
||||
on enter (scene_example_st: mut SceneExampleState) { scene_example_st.elapsed_frames = 0 }
|
||||
layer World {
|
||||
handler DrawWorld phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue