{"id":196938,"student_id":2589,"content":"","created_at":"2020-10-19T17:09:28.774+08:00","updated_at":"2023-05-09T10:19:05.120+08:00","name":"射擊氣球 - 開始後用滑鼠點擊舞台以啟用按鍵,重整畫面即可重新遊戲。","language":"python","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/196938/d0a81ce81195fd74f12f722f13ecb19c.jpg"},"parent_id":4,"plugin":"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() + 60 #遊戲結束時間點\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 -= 6\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 += 3\n if b.costume_id == 6: end_time = time.time()\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","description":null,"note":null,"status":"public","like_student_ids":[12215,21162,12113,11579,22864,6919,11498,15249,16480,7403,18335,23810,9253,9254,15565,16638,12347,23086,15259,22240,22072,26694,34617,17411,32647,23147,30022,29481,30556,28540,33563,24495,26482,29570,23575,47732,26650,26388,38763,11079,27966,27694,54059,29173,43026,23594,9872,7689,11425,38994,35967,47233,32561,39037,27948,37770,42222,35917,44176,42070,43766,42279,33044,42057,28421,62418,40009],"is_featured":false,"views":3774,"hashid":"882sqye9y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3378076,"file_name":"b5.png","project_id":196938,"asset_id":270951,"created_at":"2020-10-19T17:09:48.663+08:00","updated_at":"2020-10-19T17:09:48.663+08:00"},{"id":3378077,"file_name":"b4.png","project_id":196938,"asset_id":270952,"created_at":"2020-10-19T17:09:48.667+08:00","updated_at":"2020-10-19T17:09:48.667+08:00"},{"id":3378078,"file_name":"b1.png","project_id":196938,"asset_id":270953,"created_at":"2020-10-19T17:09:48.671+08:00","updated_at":"2020-10-19T17:09:48.671+08:00"},{"id":3378079,"file_name":"b0.png","project_id":196938,"asset_id":270954,"created_at":"2020-10-19T17:09:48.675+08:00","updated_at":"2020-10-19T17:09:48.675+08:00"},{"id":3378080,"file_name":"target.png","project_id":196938,"asset_id":270955,"created_at":"2020-10-19T17:09:48.679+08:00","updated_at":"2020-10-19T17:09:48.679+08:00"},{"id":3378081,"file_name":"shot.mp3","project_id":196938,"asset_id":270956,"created_at":"2020-10-19T17:09:48.684+08:00","updated_at":"2020-10-19T17:09:48.684+08:00"},{"id":3378082,"file_name":"r10.png","project_id":196938,"asset_id":270957,"created_at":"2020-10-19T17:09:48.688+08:00","updated_at":"2020-10-19T17:09:48.688+08:00"},{"id":3378083,"file_name":"r9.png","project_id":196938,"asset_id":270958,"created_at":"2020-10-19T17:09:48.693+08:00","updated_at":"2020-10-19T17:09:48.693+08:00"},{"id":3378084,"file_name":"r8.png","project_id":196938,"asset_id":270959,"created_at":"2020-10-19T17:09:48.697+08:00","updated_at":"2020-10-19T17:09:48.697+08:00"},{"id":3378085,"file_name":"r7.png","project_id":196938,"asset_id":270960,"created_at":"2020-10-19T17:09:48.701+08:00","updated_at":"2020-10-19T17:09:48.701+08:00"},{"id":3378086,"file_name":"r6.png","project_id":196938,"asset_id":270961,"created_at":"2020-10-19T17:09:48.705+08:00","updated_at":"2020-10-19T17:09:48.705+08:00"},{"id":3378087,"file_name":"r5.png","project_id":196938,"asset_id":270962,"created_at":"2020-10-19T17:09:48.709+08:00","updated_at":"2020-10-19T17:09:48.709+08:00"},{"id":3378088,"file_name":"r4.png","project_id":196938,"asset_id":270963,"created_at":"2020-10-19T17:09:48.713+08:00","updated_at":"2020-10-19T17:09:48.713+08:00"},{"id":3378089,"file_name":"r3.png","project_id":196938,"asset_id":270964,"created_at":"2020-10-19T17:09:48.717+08:00","updated_at":"2020-10-19T17:09:48.717+08:00"},{"id":3378090,"file_name":"r2.png","project_id":196938,"asset_id":270965,"created_at":"2020-10-19T17:09:48.721+08:00","updated_at":"2020-10-19T17:09:48.721+08:00"},{"id":3378091,"file_name":"r1.png","project_id":196938,"asset_id":270966,"created_at":"2020-10-19T17:09:48.724+08:00","updated_at":"2020-10-19T17:09:48.724+08:00"},{"id":3378092,"file_name":"r0.png","project_id":196938,"asset_id":270967,"created_at":"2020-10-19T17:09:48.728+08:00","updated_at":"2020-10-19T17:09:48.728+08:00"},{"id":3378093,"file_name":"pointer.png","project_id":196938,"asset_id":270968,"created_at":"2020-10-19T17:09:48.732+08:00","updated_at":"2020-10-19T17:09:48.732+08:00"},{"id":3378094,"file_name":"n5.png","project_id":196938,"asset_id":270969,"created_at":"2020-10-19T17:09:48.735+08:00","updated_at":"2020-10-19T17:09:48.735+08:00"},{"id":3378095,"file_name":"n4.png","project_id":196938,"asset_id":270970,"created_at":"2020-10-19T17:09:48.739+08:00","updated_at":"2020-10-19T17:09:48.739+08:00"},{"id":3378096,"file_name":"n3.png","project_id":196938,"asset_id":270971,"created_at":"2020-10-19T17:09:48.742+08:00","updated_at":"2020-10-19T17:09:48.742+08:00"},{"id":3378097,"file_name":"n2.png","project_id":196938,"asset_id":270972,"created_at":"2020-10-19T17:09:48.755+08:00","updated_at":"2020-10-19T17:09:48.755+08:00"},{"id":3378098,"file_name":"n1.png","project_id":196938,"asset_id":270973,"created_at":"2020-10-19T17:09:48.758+08:00","updated_at":"2020-10-19T17:09:48.758+08:00"},{"id":3378099,"file_name":"n0.png","project_id":196938,"asset_id":270974,"created_at":"2020-10-19T17:09:48.762+08:00","updated_at":"2020-10-19T17:09:48.762+08:00"},{"id":3378100,"file_name":"b6.png","project_id":196938,"asset_id":270975,"created_at":"2020-10-19T17:09:48.766+08:00","updated_at":"2020-10-19T17:09:48.766+08:00"},{"id":3378101,"file_name":"b3.png","project_id":196938,"asset_id":270976,"created_at":"2020-10-19T17:09:48.770+08:00","updated_at":"2020-10-19T17:09:48.770+08:00"},{"id":3378102,"file_name":"bgm.mp3","project_id":196938,"asset_id":270977,"created_at":"2020-10-19T17:09:48.861+08:00","updated_at":"2020-10-19T17:09:48.861+08:00"},{"id":3378103,"file_name":"bg_2.png","project_id":196938,"asset_id":270978,"created_at":"2020-10-19T17:09:48.868+08:00","updated_at":"2020-10-19T17:09:48.868+08:00"},{"id":3378104,"file_name":"bg_1.png","project_id":196938,"asset_id":270979,"created_at":"2020-10-19T17:09:48.872+08:00","updated_at":"2020-10-19T17:09:48.872+08:00"},{"id":3378105,"file_name":"b2.png","project_id":196938,"asset_id":270980,"created_at":"2020-10-19T17:09:48.885+08:00","updated_at":"2020-10-19T17:09:48.885+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦