The same bubbles โ but both searches are written in 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/bubbles_rules.py | The rules: aiming, sticking, popping, falling | turn_shooter, same_group, pop_group, drop_floaters |
| pylib/bubbles_draw.py | Painting the bubbles โ Python calling the canvas | draw_bubble, draw_shooter, render_game |
| pylib/bubbles_web.py | The glue: the held keys, tap-to-aim, the loop | do_action, on_board_click, frame |
๐ Compare the two versions. Open lib/bubbles-rules.js and pylib/bubbles_rules.py side by side โ same ideas, two languages.
๐ ๏ธ Build it yourself: Build Bubble Shooter 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.