{"id":249673,"student_id":1998,"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# create_sound(\"bgm.mp3\") == True\nclock = 0 #紀錄遊戲迴圈次數\nscores = 0 #玩家得分\nballoons = [] #存放氣球角色\nend_time = time.time() + 17 #遊戲結束時間點\n\ndef loop ():\n global clock, scores, end_time\n target.x = cursor.x\n target.y = cursor.y\n \n 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 \n if rand \u003c 0.4: b.costume_id = 0\n elif rand \u003c 0.6: b.costume_id = 1\n elif rand \u003c 0.7: b.costume_id = 2\n elif rand \u003c 0.8: b.costume_id = 3\n elif rand \u003c 0.9: b.costume_id = 5\n elif rand \u003c 0.92: b.costume_id = 4\n else: b.costume_id = 6\n balloons.append(b)\n for b in balloons:\n if b.costume_id == 0: b.y -= 3\n if b.costume_id == 1: b.y -= 5\n if b.costume_id == 2: b.y -= 7\n if b.costume_id == 3: b.y -= 8\n if b.costume_id == 4: b.y -= 8\n if b.costume_id == 5: b.y -= 7\n if b.costume_id == 6: b.y -= 9\n \n if b.touched(cursor) and cursor.is_down:\n b.destroy()\n if b.costume_id == 0: scores += 1\n if b.costume_id == 1: scores += 5\n if b.costume_id == 2: scores += 10\n if b.costume_id == 3: scores = scores * 2\n if b.costume_id == 4: scores = scores / 2\n if b.costume_id == 5: end_time += 3\n if b.costume_id == 6: end_time = time.time() \n create_sound(\"shot.mp3\")\n countdown = int(end_time - time.time())\n number.hidden = countdown \u003e 5\n if countdown == 5: number.costume_id = 5\n if countdown == 4: number.costume_id = 4\n if countdown == 3: number.costume_id = 3\n if countdown == 2: number.costume_id = 2\n if countdown == 1: number.costume_id = 1\n if countdown \u003c 0:\n stop()\n reward.hidden = False\n if scores \u003c 10: reward.costume_id = 10\n elif scores \u003c 100: reward.costume_id = 9\n elif scores \u003c 1000: reward.costume_id = 8\n elif scores \u003c 10000: reward.costume_id = 7\n elif scores \u003c 100000: reward.costume_id = 6\n elif scores \u003c 1000000: reward.costume_id = 5\n elif scores \u003c 10000000: reward.costume_id = 4\n elif scores \u003c 100000000: reward.costume_id = 3\n elif scores \u003c 1000000000: reward.costume_id = 2\n elif scores \u003c 10000000000: reward.costume_id = 1\n else: reward.costume_id = 0\n draw_text(int(countdown),3000,20,\"White\", 40 )\n draw_text(str(countdown) + 's',800,20,\"Green\", 40 )\n draw_text(int(scores), 60, 20 ,\"Blue\", 40 )\nforever(loop) #不斷執行遊戲迴圈\n\n","created_at":"2021-05-02T13:44:13.806+08:00","updated_at":"2021-05-04T22:19:26.272+08:00","name":"射擊氣球(預設版) 副本","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/249673/a32982ee9832059986a7455a8dd7465b.jpg"},"parent_id":183418,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":30,"hashid":"rdvs63evd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4694799,"file_name":"target.png","project_id":249673,"asset_id":251871,"created_at":"2021-05-02T13:44:13.831+08:00","updated_at":"2021-05-02T13:44:13.831+08:00"},{"id":4694800,"file_name":"b0.png","project_id":249673,"asset_id":251872,"created_at":"2021-05-02T13:44:13.832+08:00","updated_at":"2021-05-02T13:44:13.832+08:00"},{"id":4694801,"file_name":"b1.png","project_id":249673,"asset_id":251873,"created_at":"2021-05-02T13:44:13.832+08:00","updated_at":"2021-05-02T13:44:13.832+08:00"},{"id":4694802,"file_name":"b4.png","project_id":249673,"asset_id":251874,"created_at":"2021-05-02T13:44:13.833+08:00","updated_at":"2021-05-02T13:44:13.833+08:00"},{"id":4694803,"file_name":"b5.png","project_id":249673,"asset_id":251875,"created_at":"2021-05-02T13:44:13.834+08:00","updated_at":"2021-05-02T13:44:13.834+08:00"},{"id":4694774,"file_name":"b2.png","project_id":249673,"asset_id":251846,"created_at":"2021-05-02T13:44:13.811+08:00","updated_at":"2021-05-02T13:44:13.811+08:00"},{"id":4694775,"file_name":"bg_1.png","project_id":249673,"asset_id":251847,"created_at":"2021-05-02T13:44:13.812+08:00","updated_at":"2021-05-02T13:44:13.812+08:00"},{"id":4694776,"file_name":"bg_2.png","project_id":249673,"asset_id":251848,"created_at":"2021-05-02T13:44:13.813+08:00","updated_at":"2021-05-02T13:44:13.813+08:00"},{"id":4694777,"file_name":"bgm.mp3","project_id":249673,"asset_id":251849,"created_at":"2021-05-02T13:44:13.813+08:00","updated_at":"2021-05-02T13:44:13.813+08:00"},{"id":4694778,"file_name":"b3.png","project_id":249673,"asset_id":251850,"created_at":"2021-05-02T13:44:13.814+08:00","updated_at":"2021-05-02T13:44:13.814+08:00"},{"id":4694779,"file_name":"b6.png","project_id":249673,"asset_id":251851,"created_at":"2021-05-02T13:44:13.815+08:00","updated_at":"2021-05-02T13:44:13.815+08:00"},{"id":4694780,"file_name":"n0.png","project_id":249673,"asset_id":251852,"created_at":"2021-05-02T13:44:13.816+08:00","updated_at":"2021-05-02T13:44:13.816+08:00"},{"id":4694781,"file_name":"n1.png","project_id":249673,"asset_id":251853,"created_at":"2021-05-02T13:44:13.817+08:00","updated_at":"2021-05-02T13:44:13.817+08:00"},{"id":4694782,"file_name":"n2.png","project_id":249673,"asset_id":251854,"created_at":"2021-05-02T13:44:13.817+08:00","updated_at":"2021-05-02T13:44:13.817+08:00"},{"id":4694783,"file_name":"n3.png","project_id":249673,"asset_id":251855,"created_at":"2021-05-02T13:44:13.818+08:00","updated_at":"2021-05-02T13:44:13.818+08:00"},{"id":4694784,"file_name":"n4.png","project_id":249673,"asset_id":251856,"created_at":"2021-05-02T13:44:13.819+08:00","updated_at":"2021-05-02T13:44:13.819+08:00"},{"id":4694785,"file_name":"n5.png","project_id":249673,"asset_id":251857,"created_at":"2021-05-02T13:44:13.820+08:00","updated_at":"2021-05-02T13:44:13.820+08:00"},{"id":4694786,"file_name":"pointer.png","project_id":249673,"asset_id":251858,"created_at":"2021-05-02T13:44:13.821+08:00","updated_at":"2021-05-02T13:44:13.821+08:00"},{"id":4694787,"file_name":"r0.png","project_id":249673,"asset_id":251859,"created_at":"2021-05-02T13:44:13.821+08:00","updated_at":"2021-05-02T13:44:13.821+08:00"},{"id":4694788,"file_name":"r1.png","project_id":249673,"asset_id":251860,"created_at":"2021-05-02T13:44:13.822+08:00","updated_at":"2021-05-02T13:44:13.822+08:00"},{"id":4694789,"file_name":"r2.png","project_id":249673,"asset_id":251861,"created_at":"2021-05-02T13:44:13.823+08:00","updated_at":"2021-05-02T13:44:13.823+08:00"},{"id":4694790,"file_name":"r3.png","project_id":249673,"asset_id":251862,"created_at":"2021-05-02T13:44:13.824+08:00","updated_at":"2021-05-02T13:44:13.824+08:00"},{"id":4694791,"file_name":"r4.png","project_id":249673,"asset_id":251863,"created_at":"2021-05-02T13:44:13.825+08:00","updated_at":"2021-05-02T13:44:13.825+08:00"},{"id":4694792,"file_name":"r5.png","project_id":249673,"asset_id":251864,"created_at":"2021-05-02T13:44:13.825+08:00","updated_at":"2021-05-02T13:44:13.825+08:00"},{"id":4694793,"file_name":"r6.png","project_id":249673,"asset_id":251865,"created_at":"2021-05-02T13:44:13.826+08:00","updated_at":"2021-05-02T13:44:13.826+08:00"},{"id":4694794,"file_name":"r7.png","project_id":249673,"asset_id":251866,"created_at":"2021-05-02T13:44:13.827+08:00","updated_at":"2021-05-02T13:44:13.827+08:00"},{"id":4694795,"file_name":"r8.png","project_id":249673,"asset_id":251867,"created_at":"2021-05-02T13:44:13.828+08:00","updated_at":"2021-05-02T13:44:13.828+08:00"},{"id":4694796,"file_name":"r9.png","project_id":249673,"asset_id":251868,"created_at":"2021-05-02T13:44:13.829+08:00","updated_at":"2021-05-02T13:44:13.829+08:00"},{"id":4694797,"file_name":"r10.png","project_id":249673,"asset_id":251869,"created_at":"2021-05-02T13:44:13.829+08:00","updated_at":"2021-05-02T13:44:13.829+08:00"},{"id":4694798,"file_name":"shot.mp3","project_id":249673,"asset_id":251870,"created_at":"2021-05-02T13:44:13.830+08:00","updated_at":"2021-05-02T13:44:13.830+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦