{"id":1023918,"student_id":2589,"content":"import time\nimport random\nimport math\nfrom game import (\n create_sprite,\n create_sound,\n cursor,\n draw_text,\n forever,\n stop,\n)\n\nbg_1 = create_sprite('bg_1.png')\nbg_2 = create_sprite('bg_2.png')\ntarget = create_sprite('target.png')\nnumber = create_sprite('n0.png', 'n1.png', 'n2.png', 'n3.png', 'n4.png', 'n5.png')\nreward = create_sprite('r0.png', 'r1.png', 'r2.png', 'r3.png', 'r4.png', 'r5.png', 'r6.png', 'r7.png', 'r8.png', 'r9.png', 'r10.png')\n\nbg_1.layer = 1\nnumber.layer = 2\ntarget.layer = 3\nreward.layer = 4\nreward.hidden = True\nnumber.opacity = 0.7\nnumber.hidden = True\n\nclock = 0\nscore = 0\nballoons = []\nend_time = time.time() + 15\n\ncreate_sound('bgm.mp3', True)\n\n\ndef loop():\n global clock, score, end_time\n\n target.x = cursor.x\n target.y = cursor.y\n\n clock = clock + 1\n if clock % 10 == 0:\n b = create_sprite('b0.png', 'b1.png', 'b2.png', 'b3.png', 'b4.png', 'b5.png', 'b6.png')\n b.y = 1000\n b.x = random.randrange(100, 1100)\n\n rand = random.random()\n if rand \u003c 0.4:\n b.costume_id = 0\n elif rand \u003c 0.6:\n b.costume_id = 1\n elif rand \u003c 0.7:\n b.costume_id = 2\n elif rand \u003c 0.8:\n b.costume_id = 3\n elif rand \u003c 0.9:\n b.costume_id = 4\n elif rand \u003c 0.95:\n b.costume_id = 5\n else:\n b.costume_id = 6\n \n balloons.append(b)\n \n for b in balloons:\n if b.costume_id == 0:\n b.y = b.y - 3\n if b.costume_id == 1:\n b.y = b.y - 5\n if b.costume_id == 2:\n b.y = b.y - 7\n if b.costume_id == 3:\n b.y = b.y - 8\n if b.costume_id == 4:\n b.y = b.y - 8\n if b.costume_id == 5:\n b.y = b.y - 7\n if b.costume_id == 6:\n b.y = b.y - 9\n \n if b.touched(cursor) == True and cursor.is_down == True:\n b.destroy()\n if b.costume_id == 0:\n score = score + 1\n if b.costume_id == 1:\n score = score + 5\n if b.costume_id == 2:\n score = score + 10\n if b.costume_id == 3:\n score = score * 2\n if b.costume_id == 4:\n score = score / 2\n if b.costume_id == 5:\n end_time = time.time()\n if b.costume_id == 6:\n end_time = end_time + 3\n create_sound('shot.mp3')\n \n countdown = int(end_time - time.time())\n\n if countdown \u003c= 5:\n number.hidden = False\n number.costume_id = countdown\n \n if countdown \u003c= 0:\n stop()\n reward.hidden = False\n if score \u003c 10:\n reward.costume_id = 10\n elif score \u003c 100:\n reward.costume_id = 9\n elif score \u003c 1000:\n reward.costume_id = 8\n elif score \u003c 10000:\n reward.costume_id = 7\n elif score \u003c 100000:\n reward.costume_id = 6\n elif score \u003c 1000000:\n reward.costume_id = 5\n elif score \u003c 10000000:\n reward.costume_id = 4\n elif score \u003c 100000000:\n reward.costume_id = 3\n elif score \u003c 1000000000:\n reward.costume_id = 2\n elif score \u003c 10000000000:\n reward.costume_id = 1\n else:\n reward.costume_id = 0\n \n draw_text(countdown, 150, 20, 'white', 40)\n draw_text(int(score), 60, 20, 'white', 40)\n\n\nforever(loop)\n","created_at":"2025-05-29T13:11:41.030+08:00","updated_at":"2025-05-29T13:13:16.452+08:00","name":"13_B_C_射擊氣球_綜合練習_【講解】遊戲音效 副本","language":"python","screenshot":{"url":null},"parent_id":1012162,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":59,"hashid":"vngsvv8zw","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":38687601,"file_name":"b2.png","project_id":1023918,"asset_id":251846,"created_at":"2025-05-29T13:11:41.036+08:00","updated_at":"2025-05-29T13:11:41.036+08:00"},{"id":38687602,"file_name":"bg_1.png","project_id":1023918,"asset_id":251847,"created_at":"2025-05-29T13:11:41.037+08:00","updated_at":"2025-05-29T13:11:41.037+08:00"},{"id":38687603,"file_name":"bg_2.png","project_id":1023918,"asset_id":251848,"created_at":"2025-05-29T13:11:41.038+08:00","updated_at":"2025-05-29T13:11:41.038+08:00"},{"id":38687604,"file_name":"bgm.mp3","project_id":1023918,"asset_id":251849,"created_at":"2025-05-29T13:11:41.038+08:00","updated_at":"2025-05-29T13:11:41.038+08:00"},{"id":38687605,"file_name":"b3.png","project_id":1023918,"asset_id":251850,"created_at":"2025-05-29T13:11:41.039+08:00","updated_at":"2025-05-29T13:11:41.039+08:00"},{"id":38687606,"file_name":"n0.png","project_id":1023918,"asset_id":251852,"created_at":"2025-05-29T13:11:41.040+08:00","updated_at":"2025-05-29T13:11:41.040+08:00"},{"id":38687607,"file_name":"n1.png","project_id":1023918,"asset_id":251853,"created_at":"2025-05-29T13:11:41.041+08:00","updated_at":"2025-05-29T13:11:41.041+08:00"},{"id":38687608,"file_name":"n2.png","project_id":1023918,"asset_id":251854,"created_at":"2025-05-29T13:11:41.042+08:00","updated_at":"2025-05-29T13:11:41.042+08:00"},{"id":38687609,"file_name":"n3.png","project_id":1023918,"asset_id":251855,"created_at":"2025-05-29T13:11:41.043+08:00","updated_at":"2025-05-29T13:11:41.043+08:00"},{"id":38687610,"file_name":"n4.png","project_id":1023918,"asset_id":251856,"created_at":"2025-05-29T13:11:41.044+08:00","updated_at":"2025-05-29T13:11:41.044+08:00"},{"id":38687611,"file_name":"n5.png","project_id":1023918,"asset_id":251857,"created_at":"2025-05-29T13:11:41.045+08:00","updated_at":"2025-05-29T13:11:41.045+08:00"},{"id":38687612,"file_name":"pointer.png","project_id":1023918,"asset_id":251858,"created_at":"2025-05-29T13:11:41.046+08:00","updated_at":"2025-05-29T13:11:41.046+08:00"},{"id":38687613,"file_name":"r0.png","project_id":1023918,"asset_id":251859,"created_at":"2025-05-29T13:11:41.047+08:00","updated_at":"2025-05-29T13:11:41.047+08:00"},{"id":38687614,"file_name":"r1.png","project_id":1023918,"asset_id":251860,"created_at":"2025-05-29T13:11:41.048+08:00","updated_at":"2025-05-29T13:11:41.048+08:00"},{"id":38687615,"file_name":"r2.png","project_id":1023918,"asset_id":251861,"created_at":"2025-05-29T13:11:41.049+08:00","updated_at":"2025-05-29T13:11:41.049+08:00"},{"id":38687616,"file_name":"r3.png","project_id":1023918,"asset_id":251862,"created_at":"2025-05-29T13:11:41.049+08:00","updated_at":"2025-05-29T13:11:41.049+08:00"},{"id":38687617,"file_name":"r4.png","project_id":1023918,"asset_id":251863,"created_at":"2025-05-29T13:11:41.050+08:00","updated_at":"2025-05-29T13:11:41.050+08:00"},{"id":38687618,"file_name":"r5.png","project_id":1023918,"asset_id":251864,"created_at":"2025-05-29T13:11:41.051+08:00","updated_at":"2025-05-29T13:11:41.051+08:00"},{"id":38687619,"file_name":"r6.png","project_id":1023918,"asset_id":251865,"created_at":"2025-05-29T13:11:41.052+08:00","updated_at":"2025-05-29T13:11:41.052+08:00"},{"id":38687620,"file_name":"r7.png","project_id":1023918,"asset_id":251866,"created_at":"2025-05-29T13:11:41.053+08:00","updated_at":"2025-05-29T13:11:41.053+08:00"},{"id":38687621,"file_name":"r8.png","project_id":1023918,"asset_id":251867,"created_at":"2025-05-29T13:11:41.054+08:00","updated_at":"2025-05-29T13:11:41.054+08:00"},{"id":38687622,"file_name":"r9.png","project_id":1023918,"asset_id":251868,"created_at":"2025-05-29T13:11:41.055+08:00","updated_at":"2025-05-29T13:11:41.055+08:00"},{"id":38687623,"file_name":"r10.png","project_id":1023918,"asset_id":251869,"created_at":"2025-05-29T13:11:41.056+08:00","updated_at":"2025-05-29T13:11:41.056+08:00"},{"id":38687624,"file_name":"shot.mp3","project_id":1023918,"asset_id":251870,"created_at":"2025-05-29T13:11:41.057+08:00","updated_at":"2025-05-29T13:11:41.057+08:00"},{"id":38687625,"file_name":"target.png","project_id":1023918,"asset_id":251871,"created_at":"2025-05-29T13:11:41.058+08:00","updated_at":"2025-05-29T13:11:41.058+08:00"},{"id":38687626,"file_name":"b0.png","project_id":1023918,"asset_id":251872,"created_at":"2025-05-29T13:11:41.059+08:00","updated_at":"2025-05-29T13:11:41.059+08:00"},{"id":38687627,"file_name":"b1.png","project_id":1023918,"asset_id":251873,"created_at":"2025-05-29T13:11:41.060+08:00","updated_at":"2025-05-29T13:11:41.060+08:00"},{"id":38687628,"file_name":"b4.png","project_id":1023918,"asset_id":251874,"created_at":"2025-05-29T13:11:41.060+08:00","updated_at":"2025-05-29T13:11:41.060+08:00"},{"id":38687629,"file_name":"b5.png","project_id":1023918,"asset_id":251851,"created_at":"2025-05-29T13:11:41.061+08:00","updated_at":"2025-05-29T13:11:41.061+08:00"},{"id":38687630,"file_name":"b6.png","project_id":1023918,"asset_id":251875,"created_at":"2025-05-29T13:11:41.062+08:00","updated_at":"2025-05-29T13:11:41.062+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦