code / tomo-game

Lines231 Tomo187 Text18 Markdown16 make10
(29 lines)
1 # This game demo uses Raylib to present a simple maze-type game
2 use ./raylib.tm
3 use ./world.tm
5 func main(map=(./map.txt))
6 InitWindow(1600, 900, CString("raylib [core] example - 2d camera"))
8 map_contents := map.read() or exit("Could not find the game map: $map")
10 world := @World(
11 player=@Player(Vector2(0,0), Vector2(0,0)),
12 goal=@Box(Vector2(0,0), Vector2(50,50), color=Color(0x10,0xa0,0x10)),
13 boxes=@[],
15 world.load_map(map_contents)
17 SetTargetFPS(60)
19 while not WindowShouldClose()
20 dt := GetFrameTime()
21 world.update(dt)
23 BeginDrawing()
24 ClearBackground(Color(0xCC, 0xCC, 0xCC, 0xFF))
25 world.draw()
26 EndDrawing()
28 CloseWindow()