aboutsummaryrefslogtreecommitdiff
path: root/examples/game
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-10 13:42:57 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-10 13:42:57 -0400
commita6d48e46c122594aa5d877c9f902484339103ea9 (patch)
tree9a4cb03af187f4f7742b8933a7c0069e17b4ddd1 /examples/game
parent839abfc29425873f5610467b8facac44ad784e19 (diff)
Fixes for examples
Diffstat (limited to 'examples/game')
-rw-r--r--examples/game/game.tm2
-rw-r--r--examples/game/player.tm6
-rw-r--r--examples/game/world.tm2
3 files changed, 5 insertions, 5 deletions
diff --git a/examples/game/game.tm b/examples/game/game.tm
index 81aed45f..86e4e01c 100644
--- a/examples/game/game.tm
+++ b/examples/game/game.tm
@@ -7,7 +7,7 @@ use ./world.tm
func main(map=(./map.txt)):
extern InitWindow:func(w:Int32, h:Int32, title:CString)
- InitWindow(1600, 900, "raylib [core] example - 2d camera")
+ InitWindow(1600, 900, CString("raylib [core] example - 2d camera"))
map_contents := map:read() or exit("Could not find the game map: $map")
diff --git a/examples/game/player.tm b/examples/game/player.tm
index 91f7a173..a5c39a8d 100644
--- a/examples/game/player.tm
+++ b/examples/game/player.tm
@@ -19,11 +19,11 @@ struct Player(pos,prev_pos:Vec2):
target_y := inline C:Num {
(Num_t)((IsKeyDown(KEY_W) ? -1 : 0) + (IsKeyDown(KEY_S) ? 1 : 0))
}
- target_vel := Vec2(target_x, target_y):norm() * WALK_SPEED
+ target_vel := Vec2(target_x, target_y):norm() * Player.WALK_SPEED
vel := (p.pos - p.prev_pos)/World.DT
- vel *= FRICTION
- vel = vel:mix(target_vel, ACCEL)
+ vel *= Player.FRICTION
+ vel = vel:mix(target_vel, Player.ACCEL)
p.prev_pos, p.pos = p.pos, p.pos + World.DT*vel
diff --git a/examples/game/world.tm b/examples/game/world.tm
index 0a2439c2..f1b65a87 100644
--- a/examples/game/world.tm
+++ b/examples/game/world.tm
@@ -58,7 +58,7 @@ struct World(player:@Player, goal:@Box, boxes:@[@Box], dt_accum=0.0, won=no):
# Resolve player overlapping with any boxes:
for i in 3:
for b in w.boxes:
- w.player.pos += STIFFNESS * solve_overlap(w.player.pos, Player.SIZE, b.pos, b.size)
+ w.player.pos += World.STIFFNESS * solve_overlap(w.player.pos, Player.SIZE, b.pos, b.size)
func draw(w:@World):
for b in w.boxes: