๐Ÿชœ HUNDRED FLOORS in Python

The same shaft โ€” but the camera and the landings are all Python

โ† Back to Fun Time
๐Ÿ Starting Pythonโ€ฆ
Floor
1
Blood
10 / 10
Score
0
Deepest
0

โŒจ๏ธ Controls

  • โ† โ†’ or A D walk โ€” hold them down
  • On a phone: hold your finger on the left or right half of the shaft
  • There is no jump. You go DOWN by walking off an edge.
  • P pause  โ€ข  R new game
  • ๐ŸŽฎ Xbox controller? Just plug it in or pair it โ€” the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

๐ŸŽฏ How to play

  • Keep landing on the platforms. Miss them all and you fall off the bottom โ€” that is the end.
  • The view keeps sinking, so standing still pushes you up into the spiked ceiling.
  • Land on a platform with ้”ฏ้ฝฟ sawteeth and it costs you two blood.
  • Ten blood. Five spiked landings and you are finished.

๐Ÿชœ The six platforms

  • Plain โ€” a solid bar. Perfectly safe.
  • ้”ฏ้ฝฟ spiked โ€” sawteeth on top. Avoid these.
  • Arrows โ€” a moving floor that carries you that way.
  • Coil โ€” a spring, and it throws you straight back up.
  • Dashed โ€” it crumbles away a moment after you land.

๐Ÿง‘โ€๐Ÿ’ป This whole game is Python

There 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.