{"id":179551,"student_id":10,"content":"import time #載入時間計算套件\nimport random #載入產生隨機數套件\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.hidden = True\nnumber.opacity = 0.7\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 += 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: 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 = 4\n elif rand \u003c 0.95: b.costume_id = 5\n else: b.costume_id = 6\n \n balloons.append(b)\n \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: score += 1\n if b.costume_id == 1: score += 5\n if b.costume_id == 2: score += 10\n if b.costume_id == 3: score *= 2\n if b.costume_id == 4: score /= 2\n if b.costume_id == 5: end_time = time.time()\n if b.costume_id == 6: end_time += 3\n create_sound('shot.mp3')\n \n #遊戲剩餘秒數\n countdown = int(end_time - time.time())\n \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 == 0: number.costume_id = 0\n \n #遊戲結束\n if countdown \u003c 0:\n stop()\n reward.hidden = False\n if score \u003c 10: reward.costume_id = 10\n elif score \u003c 100: reward.costume_id = 9\n elif score \u003c 1000: reward.costume_id = 8\n elif score \u003c 10000: reward.costume_id = 7\n elif score \u003c 100000: reward.costume_id = 6\n elif score \u003c 1000000: reward.costume_id = 5\n elif score \u003c 10000000: reward.costume_id = 4\n elif score \u003c 100000000: reward.costume_id = 3\n elif score \u003c 1000000000: reward.costume_id = 2\n elif score \u003c 10000000000: reward.costume_id = 1\n else: 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\n","created_at":"2020-08-10T10:56:14.050+08:00","updated_at":"2020-10-23T17:14:28.737+08:00","name":"射擊氣球(錄影版)","language":"python","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/179551/7b859e44b152bf3c9ca166e1bf08aca9.jpg"},"parent_id":150223,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":260,"hashid":"qmdsn2w8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3067192,"file_name":"b4.png","project_id":179551,"asset_id":199817,"created_at":"2020-08-10T10:56:14.058+08:00","updated_at":"2020-08-10T10:56:14.058+08:00"},{"id":3067193,"file_name":"b1.png","project_id":179551,"asset_id":198397,"created_at":"2020-08-10T10:56:14.059+08:00","updated_at":"2020-08-10T10:56:14.059+08:00"},{"id":3067194,"file_name":"b0.png","project_id":179551,"asset_id":199819,"created_at":"2020-08-10T10:56:14.060+08:00","updated_at":"2020-08-10T10:56:14.060+08:00"},{"id":3067195,"file_name":"target.png","project_id":179551,"asset_id":199868,"created_at":"2020-08-10T10:56:14.061+08:00","updated_at":"2020-08-10T10:56:14.061+08:00"},{"id":3067196,"file_name":"shot.mp3","project_id":179551,"asset_id":172349,"created_at":"2020-08-10T10:56:14.062+08:00","updated_at":"2020-08-10T10:56:14.062+08:00"},{"id":3067197,"file_name":"r10.png","project_id":179551,"asset_id":199879,"created_at":"2020-08-10T10:56:14.064+08:00","updated_at":"2020-08-10T10:56:14.064+08:00"},{"id":3067198,"file_name":"r9.png","project_id":179551,"asset_id":199866,"created_at":"2020-08-10T10:56:14.065+08:00","updated_at":"2020-08-10T10:56:14.065+08:00"},{"id":3067199,"file_name":"r8.png","project_id":179551,"asset_id":199865,"created_at":"2020-08-10T10:56:14.067+08:00","updated_at":"2020-08-10T10:56:14.067+08:00"},{"id":3067200,"file_name":"r7.png","project_id":179551,"asset_id":199864,"created_at":"2020-08-10T10:56:14.068+08:00","updated_at":"2020-08-10T10:56:14.068+08:00"},{"id":3067201,"file_name":"r6.png","project_id":179551,"asset_id":199863,"created_at":"2020-08-10T10:56:14.069+08:00","updated_at":"2020-08-10T10:56:14.069+08:00"},{"id":3067202,"file_name":"r5.png","project_id":179551,"asset_id":199862,"created_at":"2020-08-10T10:56:14.070+08:00","updated_at":"2020-08-10T10:56:14.070+08:00"},{"id":3067203,"file_name":"r4.png","project_id":179551,"asset_id":199861,"created_at":"2020-08-10T10:56:14.072+08:00","updated_at":"2020-08-10T10:56:14.072+08:00"},{"id":3067204,"file_name":"r3.png","project_id":179551,"asset_id":199860,"created_at":"2020-08-10T10:56:14.073+08:00","updated_at":"2020-08-10T10:56:14.073+08:00"},{"id":3067205,"file_name":"r2.png","project_id":179551,"asset_id":199859,"created_at":"2020-08-10T10:56:14.074+08:00","updated_at":"2020-08-10T10:56:14.074+08:00"},{"id":3067206,"file_name":"r1.png","project_id":179551,"asset_id":199858,"created_at":"2020-08-10T10:56:14.075+08:00","updated_at":"2020-08-10T10:56:14.075+08:00"},{"id":3067207,"file_name":"r0.png","project_id":179551,"asset_id":199857,"created_at":"2020-08-10T10:56:14.077+08:00","updated_at":"2020-08-10T10:56:14.077+08:00"},{"id":3067208,"file_name":"pointer.png","project_id":179551,"asset_id":198063,"created_at":"2020-08-10T10:56:14.078+08:00","updated_at":"2020-08-10T10:56:14.078+08:00"},{"id":3067209,"file_name":"n5.png","project_id":179551,"asset_id":199877,"created_at":"2020-08-10T10:56:14.079+08:00","updated_at":"2020-08-10T10:56:14.079+08:00"},{"id":3067210,"file_name":"n4.png","project_id":179551,"asset_id":199876,"created_at":"2020-08-10T10:56:14.080+08:00","updated_at":"2020-08-10T10:56:14.080+08:00"},{"id":3067211,"file_name":"n3.png","project_id":179551,"asset_id":199875,"created_at":"2020-08-10T10:56:14.082+08:00","updated_at":"2020-08-10T10:56:14.082+08:00"},{"id":3067212,"file_name":"n2.png","project_id":179551,"asset_id":199874,"created_at":"2020-08-10T10:56:14.082+08:00","updated_at":"2020-08-10T10:56:14.082+08:00"},{"id":3067213,"file_name":"n1.png","project_id":179551,"asset_id":199873,"created_at":"2020-08-10T10:56:14.084+08:00","updated_at":"2020-08-10T10:56:14.084+08:00"},{"id":3067214,"file_name":"n0.png","project_id":179551,"asset_id":199872,"created_at":"2020-08-10T10:56:14.085+08:00","updated_at":"2020-08-10T10:56:14.085+08:00"},{"id":3067216,"file_name":"b3.png","project_id":179551,"asset_id":199816,"created_at":"2020-08-10T10:56:14.087+08:00","updated_at":"2020-08-10T10:56:14.087+08:00"},{"id":3067217,"file_name":"bgm.mp3","project_id":179551,"asset_id":113696,"created_at":"2020-08-10T10:56:14.088+08:00","updated_at":"2020-08-10T10:56:14.088+08:00"},{"id":3067218,"file_name":"bg_2.png","project_id":179551,"asset_id":199815,"created_at":"2020-08-10T10:56:14.089+08:00","updated_at":"2020-08-10T10:56:14.089+08:00"},{"id":3067219,"file_name":"bg_1.png","project_id":179551,"asset_id":199814,"created_at":"2020-08-10T10:56:14.091+08:00","updated_at":"2020-08-10T10:56:14.091+08:00"},{"id":3067220,"file_name":"b2.png","project_id":179551,"asset_id":198394,"created_at":"2020-08-10T10:56:14.091+08:00","updated_at":"2020-08-10T10:56:14.091+08:00"},{"id":3067191,"file_name":"b6.png","project_id":179551,"asset_id":199810,"created_at":"2020-08-10T10:56:14.057+08:00","updated_at":"2020-08-11T11:48:27.350+08:00"},{"id":3067215,"file_name":"b5.png","project_id":179551,"asset_id":199818,"created_at":"2020-08-10T10:56:14.086+08:00","updated_at":"2020-08-11T11:48:33.545+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦