{"id":150223,"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.opacity = 0.7\nnumber.hidden = True\n\nclock = 0 #紀錄遊戲迴圈次數\nscore = 0 #玩家得分\nballoons = [] #存放氣球角色\nend_time = time.time() + #遊戲結束時間點\n\ncreate_sound('bgm.mp3')\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 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 b.y = 1000\n b.x = random.randrange(100, 1100)\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 cursor.is_down and b.touched(cursor):\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 b.destroy()\n create_sound('shot.mp3')\n \n draw_text(int(score), 60, 20, 'white', 40)\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 if countdown \u003c= 5 or countdown \u003e= 0:\n number.costume_id = countdown\n \n # draw_text(countdown, 150, 20, 'white', 40)\n \n if countdown \u003c 0:\n reward.hidden = False\n if score \u003e 10000000000: reward.costume_id = 0\n elif score \u003e 1000000000: reward.costume_id = 1\n elif score \u003e 100000000: reward.costume_id = 2\n elif score \u003e 10000000: reward.costume_id = 3\n elif score \u003e 1000000: reward.costume_id = 4\n elif score \u003e 100000: reward.costume_id = 5\n elif score \u003e 10000: reward.costume_id = 6\n elif score \u003e 1000: reward.costume_id = 7\n elif score \u003e 100: reward.costume_id = 8\n elif score \u003e 10: reward.costume_id = 9\n else: reward.costume_id = 10\n stop()\n \nforever(loop) #不斷執行遊戲迴圈\n\n","created_at":"2020-05-22T12:42:15.808+08:00","updated_at":"2020-08-17T10:48:35.610+08:00","name":"射擊氣球(完整版)","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/150223/4748e6e10b352736a787a4dd7414e7ed.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":296,"hashid":"36ysgj93","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2607140,"file_name":"r0.png","project_id":150223,"asset_id":199857,"created_at":"2020-05-22T12:42:52.411+08:00","updated_at":"2020-05-22T12:42:52.411+08:00"},{"id":2607141,"file_name":"r1.png","project_id":150223,"asset_id":199858,"created_at":"2020-05-22T12:42:52.412+08:00","updated_at":"2020-05-22T12:42:52.412+08:00"},{"id":2607129,"file_name":"b3.png","project_id":150223,"asset_id":199816,"created_at":"2020-05-22T12:42:50.850+08:00","updated_at":"2020-08-10T10:54:11.051+08:00"},{"id":2607136,"file_name":"n3.png","project_id":150223,"asset_id":199875,"created_at":"2020-05-22T12:42:51.826+08:00","updated_at":"2020-05-22T12:42:51.826+08:00"},{"id":2607137,"file_name":"n4.png","project_id":150223,"asset_id":199876,"created_at":"2020-05-22T12:42:51.828+08:00","updated_at":"2020-05-22T12:42:51.828+08:00"},{"id":2607142,"file_name":"r2.png","project_id":150223,"asset_id":199859,"created_at":"2020-05-22T12:42:52.861+08:00","updated_at":"2020-05-22T12:42:52.861+08:00"},{"id":2607143,"file_name":"r3.png","project_id":150223,"asset_id":199860,"created_at":"2020-05-22T12:42:52.863+08:00","updated_at":"2020-05-22T12:42:52.863+08:00"},{"id":2607146,"file_name":"r6.png","project_id":150223,"asset_id":199863,"created_at":"2020-05-22T12:42:54.101+08:00","updated_at":"2020-05-22T12:42:54.101+08:00"},{"id":2607147,"file_name":"r7.png","project_id":150223,"asset_id":199864,"created_at":"2020-05-22T12:42:54.102+08:00","updated_at":"2020-05-22T12:42:54.102+08:00"},{"id":2607148,"file_name":"r8.png","project_id":150223,"asset_id":199865,"created_at":"2020-05-22T12:42:54.504+08:00","updated_at":"2020-05-22T12:42:54.504+08:00"},{"id":2607149,"file_name":"r9.png","project_id":150223,"asset_id":199866,"created_at":"2020-05-22T12:42:54.505+08:00","updated_at":"2020-05-22T12:42:54.505+08:00"},{"id":2607150,"file_name":"r10.png","project_id":150223,"asset_id":199879,"created_at":"2020-05-22T12:42:54.832+08:00","updated_at":"2020-05-22T12:42:54.832+08:00"},{"id":2607151,"file_name":"shot.mp3","project_id":150223,"asset_id":172349,"created_at":"2020-05-22T12:42:54.834+08:00","updated_at":"2020-05-22T12:42:54.834+08:00"},{"id":2607123,"file_name":"b2.png","project_id":150223,"asset_id":198394,"created_at":"2020-05-22T12:42:47.236+08:00","updated_at":"2020-08-10T10:54:06.891+08:00"},{"id":2607134,"file_name":"n1.png","project_id":150223,"asset_id":199873,"created_at":"2020-05-22T12:42:51.597+08:00","updated_at":"2020-05-22T12:42:51.597+08:00"},{"id":2607135,"file_name":"n2.png","project_id":150223,"asset_id":199874,"created_at":"2020-05-22T12:42:51.599+08:00","updated_at":"2020-05-22T12:42:51.599+08:00"},{"id":2607124,"file_name":"bg_1.png","project_id":150223,"asset_id":199814,"created_at":"2020-05-22T12:42:47.730+08:00","updated_at":"2020-05-22T12:42:47.730+08:00"},{"id":2607125,"file_name":"bg_2.png","project_id":150223,"asset_id":199815,"created_at":"2020-05-22T12:42:47.732+08:00","updated_at":"2020-05-22T12:42:47.732+08:00"},{"id":2607126,"file_name":"bgm.mp3","project_id":150223,"asset_id":113696,"created_at":"2020-05-22T12:42:50.524+08:00","updated_at":"2020-05-22T12:42:50.524+08:00"},{"id":2607133,"file_name":"n0.png","project_id":150223,"asset_id":199872,"created_at":"2020-05-22T12:42:51.372+08:00","updated_at":"2020-05-22T12:42:51.372+08:00"},{"id":2607138,"file_name":"n5.png","project_id":150223,"asset_id":199877,"created_at":"2020-05-22T12:42:52.051+08:00","updated_at":"2020-05-22T12:42:52.051+08:00"},{"id":2607139,"file_name":"pointer.png","project_id":150223,"asset_id":198063,"created_at":"2020-05-22T12:42:52.054+08:00","updated_at":"2020-05-22T12:42:52.054+08:00"},{"id":2607152,"file_name":"target.png","project_id":150223,"asset_id":199868,"created_at":"2020-05-22T12:42:55.063+08:00","updated_at":"2020-05-22T12:42:55.063+08:00"},{"id":2607131,"file_name":"b5.png","project_id":150223,"asset_id":199818,"created_at":"2020-05-22T12:42:51.118+08:00","updated_at":"2020-08-11T11:49:42.215+08:00"},{"id":2607144,"file_name":"r4.png","project_id":150223,"asset_id":199861,"created_at":"2020-05-22T12:42:53.525+08:00","updated_at":"2020-05-22T12:42:53.525+08:00"},{"id":2607145,"file_name":"r5.png","project_id":150223,"asset_id":199862,"created_at":"2020-05-22T12:42:53.527+08:00","updated_at":"2020-05-22T12:42:53.527+08:00"},{"id":2607132,"file_name":"b6.png","project_id":150223,"asset_id":199810,"created_at":"2020-05-22T12:42:51.370+08:00","updated_at":"2020-08-11T11:49:38.792+08:00"},{"id":2607130,"file_name":"b4.png","project_id":150223,"asset_id":199817,"created_at":"2020-05-22T12:42:51.116+08:00","updated_at":"2020-08-10T10:54:15.061+08:00"},{"id":2607127,"file_name":"b1.png","project_id":150223,"asset_id":198397,"created_at":"2020-05-22T12:42:50.526+08:00","updated_at":"2020-08-10T10:54:03.528+08:00"},{"id":2607122,"file_name":"b0.png","project_id":150223,"asset_id":199819,"created_at":"2020-05-22T12:42:47.233+08:00","updated_at":"2020-08-10T10:53:51.922+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦