diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 14:20:18 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 14:20:18 -0400 |
| commit | 2bb2ff871fa1761478442bec5f6a32c9428360a1 (patch) | |
| tree | 9b73df7a0c50c02353ae7bca7c2cd54788ef0077 /examples/game/world.tm | |
| parent | 59845e610f2c90474f34079d27b5f1e07071ded4 (diff) | |
Change method calls to use `foo.baz()` instead of `foo:baz()`
Diffstat (limited to 'examples/game/world.tm')
| -rw-r--r-- | examples/game/world.tm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/game/world.tm b/examples/game/world.tm index 76acac6b..e8255ab8 100644 --- a/examples/game/world.tm +++ b/examples/game/world.tm @@ -44,11 +44,11 @@ struct World(player:@Player, goal:@Box, boxes:@[@Box], dt_accum=Num32(0.0), won= func update(w:@World, dt:Num32): w.dt_accum += dt while w.dt_accum > 0: - w:update_once() + w.update_once() w.dt_accum -= World.DT func update_once(w:@World): - w.player:update() + w.player.update() if solve_overlap(w.player.pos, Player.SIZE, w.goal.pos, w.goal.size) != Vector2(0,0): w.won = yes @@ -60,24 +60,24 @@ struct World(player:@Player, goal:@Box, boxes:@[@Box], dt_accum=Num32(0.0), won= func draw(w:@World): for b in w.boxes: - b:draw() - w.goal:draw() - w.player:draw() + b.draw() + w.goal.draw() + w.player.draw() if w.won: DrawText(CString("WINNER"), GetScreenWidth()/Int32(2)-Int32(48*3), GetScreenHeight()/Int32(2)-Int32(24), 48, Color(0,0,0)) func load_map(w:@World, map:Text): - if map:has("[]"): - map = map:translate({"[]"="#", "@ "="@", " "=" "}) + if map.has("[]"): + map = map.translate({"[]"="#", "@ "="@", " "=" "}) w.boxes = @[] box_size := Vector2(50., 50.) - for y,line in map:lines(): - for x,cell in line:split(): + for y,line in map.lines(): + for x,cell in line.split(): if cell == "#": pos := Vector2((Num32(x)-1) * box_size.x, (Num32(y)-1) * box_size.y) box := @Box(pos, size=box_size, color=Color(0x80,0x80,0x80)) - w.boxes:insert(box) + w.boxes.insert(box) else if cell == "@": pos := Vector2((Num32(x)-1) * box_size.x, (Num32(y)-1) * box_size.y) pos += box_size/Num32(2) - Player.SIZE/Num32(2) |
