最後活躍 1751731980

a library for the Myte playground that lets you easily create games

修訂 f26f43187acf9cf311f8df1e91ac06e3f5a9bef9

game.nv 原始檔案 Playground
1| 'DOCUMENTATION' | ~~
2 this game library lets you create a canvas that you can
3 update every frame . you can start a game like so :
4
5 // '' start a 400 by 600 game
6
7 and you can create a game loop that updates like this :
8
9 / '' game loop
10 / '' do something
11 '' do something else
12 '' next frame
13
14
15| '' start a $x by $y game
16| '@graphics' . canvas init canvas . set resolution $x $y
17 'DOM' ( <query canvas <style display = block margin = [1rem auto] > > )
18 '' game loop
19
20| '' next frame
21| '' @gas is now 50000
22 '@js' window.requestAnimationFrame(nextFrame);
23
24|| '@js' const nextFrame = () => { f("", "game", "loop"); me.run(); }