diff --git a/examples/game/game.tm b/examples/game/game.tm index 81aed45..86e4e01 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 91f7a17..a5c39a8 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 0a2439c..f1b65a8 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: