{"id":244903,"student_id":2002,"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 #紀錄遊戲迴圈次數\nscores = 0 #玩家得分\nballoons = [] #存放氣球角色\nend_time = time.time() + 15 #遊戲結束時間點\n\ncreate_sound(\"bgm.mp3\", True)\n\ndef loop ():\n global clock, scores, end_time\n target.x = cursor.x\n target.y = cursor.y\n clock += 1\n if clock % 10 == 0:\n balloon = create_sprite(\"b0.png\", \"b1.png\", \"b2.png\", \"b3.png\", \"b4.png\", \"b5.png\", \"b6.png\")\n balloon.x = random.randrange(100, 1100)\n balloon.y = 800\n rand = random.random()\n if rand \u003c 0.4:\n balloon.costume_id = 0\n elif rand \u003c 0.6:\n balloon.costume_id = 1\n elif rand \u003c 0.7:\n balloon.costume_id = 2\n elif rand \u003c 0.8:\n balloon.costume_id = 3\n elif rand \u003c 0.9:\n balloon.costume_id = 4\n elif rand \u003c 0.95:\n balloon.costume_id = 5\n else:\n balloon.costume_id = 6\n balloons.append(balloon)\n for balloon in balloons:\n if balloon.costume_id == 0:\n balloon.y -= 3\n elif balloon.costume_id == 1:\n balloon.y -= 5\n elif balloon.costume_id == 2:\n balloon.y -= 7\n elif balloon.costume_id == 3:\n balloon.y -= 8\n elif balloon.costume_id == 4:\n balloon.y -= 8\n elif balloon.costume_id == 5:\n balloon.y -= 7\n else:\n balloon.y -= 9\n if balloon.touched(cursor) and cursor.is_down:\n create_sound(\"shot.mp3\")\n if balloon.costume_id == 0:\n scores += 1\n elif balloon.costume_id == 1:\n scores += 5\n elif balloon.costume_id == 2:\n scores += 10\n elif balloon.costume_id == 3:\n scores *= 2\n elif balloon.costume_id == 4:\n scores /= 2\n elif balloon.costume_id == 5:\n end_time += 3\n elif balloon.costume_id == 6:\n end_time = time.time()\n balloon.destroy()\n countdown = int(end_time - time.time())\n if countdown \u003c= 5:\n number.hidden = False\n else:\n number.hidden = True\n if countdown == 5:\n number.costume_id = 5\n if countdown == 4:\n number.costume_id = 4\n if countdown == 3:\n number.costume_id = 3\n if countdown == 2:\n number.costume_id = 2\n if countdown == 1:\n number.costume_id = 1\n if countdown == 0:\n number.costume_id = 0\n if countdown == 0:\n stop()\n reward .hidden = False\n if scores \u003c 10:\n reward.costume_id = 10\n elif scores \u003c 100:\n reward.costume_id = 9\n elif scores \u003c 1000:\n reward.costume_id = 8\n elif scores \u003c 10000:\n reward.costume_id = 7\n elif scores \u003c 100000:\n reward.costume_id = 6\n elif scores \u003c 1000000:\n reward.costume_id = 5\n elif scores \u003c 10000000:\n reward.costume_id = 4\n elif scores \u003c 100000000:\n reward.costume_id = 3\n elif scores \u003c 1000000000:\n reward.costume_id = 2\n elif scores \u003c 10000000000:\n reward.costume_id = 1\n elif scores \u003c 100000000000:\n reward.costume_id = 0\n \n draw_text(str(countdown) + \"秒\", 150, 20, \"white\", 40)\n draw_text(int(scores), 60, 20, \"white\", 40)\n \nforever(loop) #不斷執行遊戲迴圈\n\n","created_at":"2021-04-18T13:33:38.855+08:00","updated_at":"2021-04-18T15:13:03.623+08:00","name":"射擊氣球(預設版) 副本","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/244903/d66eae52c579c97e444ae251eb7cabb7.jpg"},"parent_id":183418,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":45,"hashid":"6rps9dy39","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4553894,"file_name":"b2.png","project_id":244903,"asset_id":251846,"created_at":"2021-04-18T13:33:38.860+08:00","updated_at":"2021-04-18T13:33:38.860+08:00"},{"id":4553895,"file_name":"bg_1.png","project_id":244903,"asset_id":251847,"created_at":"2021-04-18T13:33:38.861+08:00","updated_at":"2021-04-18T13:33:38.861+08:00"},{"id":4553896,"file_name":"bg_2.png","project_id":244903,"asset_id":251848,"created_at":"2021-04-18T13:33:38.862+08:00","updated_at":"2021-04-18T13:33:38.862+08:00"},{"id":4553897,"file_name":"bgm.mp3","project_id":244903,"asset_id":251849,"created_at":"2021-04-18T13:33:38.863+08:00","updated_at":"2021-04-18T13:33:38.863+08:00"},{"id":4553898,"file_name":"b3.png","project_id":244903,"asset_id":251850,"created_at":"2021-04-18T13:33:38.864+08:00","updated_at":"2021-04-18T13:33:38.864+08:00"},{"id":4553899,"file_name":"b6.png","project_id":244903,"asset_id":251851,"created_at":"2021-04-18T13:33:38.865+08:00","updated_at":"2021-04-18T13:33:38.865+08:00"},{"id":4553900,"file_name":"n0.png","project_id":244903,"asset_id":251852,"created_at":"2021-04-18T13:33:38.866+08:00","updated_at":"2021-04-18T13:33:38.866+08:00"},{"id":4553901,"file_name":"n1.png","project_id":244903,"asset_id":251853,"created_at":"2021-04-18T13:33:38.867+08:00","updated_at":"2021-04-18T13:33:38.867+08:00"},{"id":4553902,"file_name":"n2.png","project_id":244903,"asset_id":251854,"created_at":"2021-04-18T13:33:38.868+08:00","updated_at":"2021-04-18T13:33:38.868+08:00"},{"id":4553903,"file_name":"n3.png","project_id":244903,"asset_id":251855,"created_at":"2021-04-18T13:33:38.869+08:00","updated_at":"2021-04-18T13:33:38.869+08:00"},{"id":4553904,"file_name":"n4.png","project_id":244903,"asset_id":251856,"created_at":"2021-04-18T13:33:38.870+08:00","updated_at":"2021-04-18T13:33:38.870+08:00"},{"id":4553905,"file_name":"n5.png","project_id":244903,"asset_id":251857,"created_at":"2021-04-18T13:33:38.870+08:00","updated_at":"2021-04-18T13:33:38.870+08:00"},{"id":4553906,"file_name":"pointer.png","project_id":244903,"asset_id":251858,"created_at":"2021-04-18T13:33:38.871+08:00","updated_at":"2021-04-18T13:33:38.871+08:00"},{"id":4553907,"file_name":"r0.png","project_id":244903,"asset_id":251859,"created_at":"2021-04-18T13:33:38.872+08:00","updated_at":"2021-04-18T13:33:38.872+08:00"},{"id":4553908,"file_name":"r1.png","project_id":244903,"asset_id":251860,"created_at":"2021-04-18T13:33:38.873+08:00","updated_at":"2021-04-18T13:33:38.873+08:00"},{"id":4553909,"file_name":"r2.png","project_id":244903,"asset_id":251861,"created_at":"2021-04-18T13:33:38.874+08:00","updated_at":"2021-04-18T13:33:38.874+08:00"},{"id":4553910,"file_name":"r3.png","project_id":244903,"asset_id":251862,"created_at":"2021-04-18T13:33:38.875+08:00","updated_at":"2021-04-18T13:33:38.875+08:00"},{"id":4553911,"file_name":"r4.png","project_id":244903,"asset_id":251863,"created_at":"2021-04-18T13:33:38.876+08:00","updated_at":"2021-04-18T13:33:38.876+08:00"},{"id":4553912,"file_name":"r5.png","project_id":244903,"asset_id":251864,"created_at":"2021-04-18T13:33:38.877+08:00","updated_at":"2021-04-18T13:33:38.877+08:00"},{"id":4553913,"file_name":"r6.png","project_id":244903,"asset_id":251865,"created_at":"2021-04-18T13:33:38.878+08:00","updated_at":"2021-04-18T13:33:38.878+08:00"},{"id":4553914,"file_name":"r7.png","project_id":244903,"asset_id":251866,"created_at":"2021-04-18T13:33:38.879+08:00","updated_at":"2021-04-18T13:33:38.879+08:00"},{"id":4553915,"file_name":"r8.png","project_id":244903,"asset_id":251867,"created_at":"2021-04-18T13:33:38.880+08:00","updated_at":"2021-04-18T13:33:38.880+08:00"},{"id":4553916,"file_name":"r9.png","project_id":244903,"asset_id":251868,"created_at":"2021-04-18T13:33:38.880+08:00","updated_at":"2021-04-18T13:33:38.880+08:00"},{"id":4553917,"file_name":"r10.png","project_id":244903,"asset_id":251869,"created_at":"2021-04-18T13:33:38.881+08:00","updated_at":"2021-04-18T13:33:38.881+08:00"},{"id":4553918,"file_name":"shot.mp3","project_id":244903,"asset_id":251870,"created_at":"2021-04-18T13:33:38.882+08:00","updated_at":"2021-04-18T13:33:38.882+08:00"},{"id":4553919,"file_name":"target.png","project_id":244903,"asset_id":251871,"created_at":"2021-04-18T13:33:38.883+08:00","updated_at":"2021-04-18T13:33:38.883+08:00"},{"id":4553920,"file_name":"b0.png","project_id":244903,"asset_id":251872,"created_at":"2021-04-18T13:33:38.884+08:00","updated_at":"2021-04-18T13:33:38.884+08:00"},{"id":4553921,"file_name":"b1.png","project_id":244903,"asset_id":251873,"created_at":"2021-04-18T13:33:38.885+08:00","updated_at":"2021-04-18T13:33:38.885+08:00"},{"id":4553922,"file_name":"b4.png","project_id":244903,"asset_id":251874,"created_at":"2021-04-18T13:33:38.886+08:00","updated_at":"2021-04-18T13:33:38.886+08:00"},{"id":4553923,"file_name":"b5.png","project_id":244903,"asset_id":251875,"created_at":"2021-04-18T13:33:38.886+08:00","updated_at":"2021-04-18T13:33:38.886+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦