The same shaft โ but the camera and the landings are all Python
โ Back to Fun TimeThere is almost no JavaScript on this page. The browser downloaded Pyodide โ a complete Python interpreter compiled to WebAssembly โ and then ran the .py files in funtime/pylib/. Python does the rules, the maths and the drawing.
| File | What it does | Good functions to try re-writing |
|---|---|---|
| pylib/floors_rules.py | The rules: the camera, the landings, the six kinds | screen_y, camera_speed, lands_on, land_on_platform |
| pylib/floors_draw.py | Painting the shaft โ Python calling the canvas | draw_sawteeth, draw_platform, render_game |
| pylib/floors_web.py | The glue: the held keys, the touch halves, the loop | do_action, on_press, frame |
๐ Compare the two versions. Open lib/floors-rules.js and pylib/floors_rules.py side by side โ same ideas, two languages.
๐ ๏ธ Build it yourself: Build Hundred Floors in Python walks you through the functions one at a time.
โ ๏ธ If the game never starts: the page has to read its .py files, which a browser will not do for a page opened straight off your disk. Use the live site, or run python3 -m http.server in the project folder.