๐Ÿซง BUBBLE SHOOTER in Python

The same bubbles โ€” but both searches are written in Python

โ† Back to Fun Time
๐Ÿ Starting Pythonโ€ฆ
Score
0
Popped
0
Shots
0
Best
0

โŒจ๏ธ Controls

  • โ† โ†’ or A D swing the aim
  • SPACE or โ†‘ shoot
  • On a phone: tap where you want the bubble to go
  • 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

  • Stick your bubble next to two more of the same kind and all three pop.
  • Bubbles are told apart by their pattern: solid, ring, dotted, striped, crossed.
  • Anything left hanging with nothing above it falls โ€” and falling is worth more.
  • If the bubbles reach the dashed line, the game is over.

๐Ÿ† Scoring

  • Popped bubble 10  โ€ข  dropped bubble 25.
  • Clearing the whole ceiling is another 500.
  • Shots bounce off the side walls โ€” that is how you reach the corners.
  • Look for the one bubble holding up a whole cluster. Pop that and the lot comes down.

๐Ÿง‘โ€๐Ÿ’ป 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/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.