{"id":182520,"student_id":10,"content":"import time #載入時間套件\nimport random #載入產生隨機數套件\nfrom game import * #載入所有遊戲中要使用的方法\n\nset_backdrop('bg.png') #背景圖\nchef = create_sprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png', 'k_6.png') #叩叮主廚\nbox = create_sprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png') #盒子\nboxs = create_sprite('dot.png', '6.png', '12.png', '18.png', '24.png', '30.png', '36.png') #完成的章魚燒盒子\nhand = create_sprite('s_0.png', 's_1.png', 's_2.png', 's_3.png') #鼠標\nhint = create_sprite('info.png') #遊戲說明\ncan = create_sprite('can.png') #垃圾桶\n\nbox.move_to(900, 530)\ncan.move_to(100, 800)\nboxs.move_to(600, 800)\nchef.move_to(900, 160)\nchef.layer = 1\nhint.layer = 2\nhand.layer = 3\n\npans = [] #存放九個烤盤角色\nscore = 0 #完成的章魚燒個數\nend_time = math.inf #遊戲結束的時間點\n\n#初始化 9 宮格烤盤\nfor y in range(3):\n for x in range(3):\n s = create_sprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png', 'p_4.png')\n s.x = 180 + x*180\n s.y = 180 + y*180\n pans.append(s)\n\ncreate_sound('bgm.mp3', True)\ncook = create_sound('cook.ogg', True)\n\n#遊戲迴圈\ndef loop ():\n \n hand.move_to(cursor)\n\n isCooking = False #是否任何一個烤盤上有東西\n \n for p in pans:\n if p.costume_id != 0:\n p.timer -= 1\n if p.timer \u003c 0:\n p.costume_id = 4 #焦掉\n elif p.timer \u003c 200:\n p.costume_id = 3 #全熟\n elif p.timer \u003c 400:\n p.costume_id = 2 #半熟\n else:\n p.costume_id = 1 #麵糊\n\n #沒有拿東西且碰到烤盤才切換造型\n if hand.costume_id != 2 and hand.costume_id != 3 and p.touched(cursor):\n if p.costume_id == 0:\n hand.costume_id = 0 #切換麵糊杯造型\n else:\n hand.costume_id = 1 #切換戳針造型\n\n if p.costume_id != 0:\n isCooking = True\n \n if p.touched(cursor) and cursor.is_down: #烤盤被點擊時\n on_click_pan(p)\n\n box.costume_id = score % 6\n boxs.costume_id = int(score/6)\n chef.costume_id = int(score/6)\n \n if hint.hidden:\n timer = int(end_time - time.time())\n if timer \u003c= 0 or score == 41: gameover()\n draw_text(str(timer) + '秒', 1000, 780, 'white', 68)\n \n cook.mute(isCooking == False)\n\n#開始遊戲\ndef start ():\n global end_time\n hint.hidden = True\n end_time = time.time() + 60\n\n# 烤盤被點擊時執行此函式\ndef on_click_pan (pan):\n if hand.costume_id != 2 and hand.costume_id != 3 and hint.hidden == True:\n if pan.costume_id == 0:\n pan.costume_id = 1\n pan.timer = 500 + random.randrange(100)\n elif pan.costume_id == 3:\n pan.costume_id = 0\n hand.costume_id = 2\n elif pan.costume_id == 4:\n pan.costume_id = 0\n hand.costume_id = 3\n\n#接盤被點擊時執行此函式\ndef on_click_box ():\n global score\n if hand.costume_id == 2:\n hand.costume_id = 0\n score += 1\n create_sound('drop.wav')\n\n#垃圾桶被點擊時執行此函式\ndef on_click_trash ():\n if hand.costume_id == 2 or hand.costume_id == 3: \n hand.costume_id = 0\n create_sound('remove.ogg')\n\n#遊戲結束\ndef gameover ():\n chef.move_to(600, 450)\n chef.scale = 2\n chef.layer = 4\n stop()\n\nforever(loop) #不斷執行遊戲迴圈\nhint.on('click', start) #開始遊戲\nbox.on('click', on_click_box) #接盤\ncan.on('click', on_click_trash) #垃圾桶\n\n","created_at":"2020-08-17T18:58:10.055+08:00","updated_at":"2020-08-21T10:58:26.900+08:00","name":"燒烤章魚小丸子(完整版)","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/182520/980cb80fcd81b4582673f05c9822c46a.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":240,"hashid":"npms2vpq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3117785,"file_name":"s_3.png","project_id":182520,"asset_id":233357,"created_at":"2020-08-21T10:23:27.306+08:00","updated_at":"2020-08-21T10:23:27.306+08:00"},{"id":3117781,"file_name":"p_4.png","project_id":182520,"asset_id":251555,"created_at":"2020-08-21T10:23:26.311+08:00","updated_at":"2020-08-21T10:23:26.311+08:00"},{"id":3117782,"file_name":"s_0.png","project_id":182520,"asset_id":233358,"created_at":"2020-08-21T10:23:26.315+08:00","updated_at":"2020-08-21T10:23:26.315+08:00"},{"id":3117757,"file_name":"6.png","project_id":182520,"asset_id":251532,"created_at":"2020-08-21T10:23:18.269+08:00","updated_at":"2020-08-21T10:31:31.023+08:00"},{"id":3117775,"file_name":"k_5.png","project_id":182520,"asset_id":251549,"created_at":"2020-08-21T10:23:24.790+08:00","updated_at":"2020-08-21T10:23:24.790+08:00"},{"id":3117776,"file_name":"k_6.png","project_id":182520,"asset_id":251550,"created_at":"2020-08-21T10:23:24.792+08:00","updated_at":"2020-08-21T10:23:24.792+08:00"},{"id":3117767,"file_name":"can.png","project_id":182520,"asset_id":251542,"created_at":"2020-08-21T10:23:21.779+08:00","updated_at":"2020-08-21T10:23:21.779+08:00"},{"id":3117768,"file_name":"dot.png","project_id":182520,"asset_id":251543,"created_at":"2020-08-21T10:23:21.781+08:00","updated_at":"2020-08-21T10:23:21.781+08:00"},{"id":3117783,"file_name":"s_1.png","project_id":182520,"asset_id":233355,"created_at":"2020-08-21T10:23:26.809+08:00","updated_at":"2020-08-21T10:23:26.809+08:00"},{"id":3117784,"file_name":"s_2.png","project_id":182520,"asset_id":233356,"created_at":"2020-08-21T10:23:26.811+08:00","updated_at":"2020-08-21T10:23:26.811+08:00"},{"id":3117769,"file_name":"info.png","project_id":182520,"asset_id":233359,"created_at":"2020-08-21T10:23:22.875+08:00","updated_at":"2020-08-21T10:23:22.875+08:00"},{"id":3117770,"file_name":"k_0.png","project_id":182520,"asset_id":251544,"created_at":"2020-08-21T10:23:22.876+08:00","updated_at":"2020-08-21T10:23:22.876+08:00"},{"id":3117755,"file_name":"4.png","project_id":182520,"asset_id":251530,"created_at":"2020-08-21T10:23:17.362+08:00","updated_at":"2020-08-21T10:23:17.362+08:00"},{"id":3117756,"file_name":"5.png","project_id":182520,"asset_id":251531,"created_at":"2020-08-21T10:23:17.363+08:00","updated_at":"2020-08-21T10:23:17.363+08:00"},{"id":3117773,"file_name":"k_3.png","project_id":182520,"asset_id":251547,"created_at":"2020-08-21T10:23:24.027+08:00","updated_at":"2020-08-21T10:23:24.027+08:00"},{"id":3117774,"file_name":"k_4.png","project_id":182520,"asset_id":251548,"created_at":"2020-08-21T10:23:24.029+08:00","updated_at":"2020-08-21T10:23:24.029+08:00"},{"id":3117765,"file_name":"48.png","project_id":182520,"asset_id":251540,"created_at":"2020-08-21T10:23:21.330+08:00","updated_at":"2020-08-21T10:23:21.330+08:00"},{"id":3117766,"file_name":"bg.png","project_id":182520,"asset_id":251541,"created_at":"2020-08-21T10:23:21.331+08:00","updated_at":"2020-08-21T10:23:21.331+08:00"},{"id":3117824,"file_name":"drop.wav","project_id":182520,"asset_id":175934,"created_at":"2020-08-21T10:46:37.383+08:00","updated_at":"2020-08-21T10:46:37.383+08:00"},{"id":3117751,"file_name":"0.png","project_id":182520,"asset_id":251526,"created_at":"2020-08-21T10:23:15.295+08:00","updated_at":"2020-08-21T10:23:15.295+08:00"},{"id":3117752,"file_name":"1.png","project_id":182520,"asset_id":251527,"created_at":"2020-08-21T10:23:15.297+08:00","updated_at":"2020-08-21T10:23:15.297+08:00"},{"id":3117779,"file_name":"p_2.png","project_id":182520,"asset_id":251553,"created_at":"2020-08-21T10:23:25.800+08:00","updated_at":"2020-08-21T10:23:25.800+08:00"},{"id":3117780,"file_name":"p_3.png","project_id":182520,"asset_id":251554,"created_at":"2020-08-21T10:23:25.802+08:00","updated_at":"2020-08-21T10:23:25.802+08:00"},{"id":3117823,"file_name":"remove.ogg","project_id":182520,"asset_id":175935,"created_at":"2020-08-21T10:46:35.436+08:00","updated_at":"2020-08-21T10:46:35.436+08:00"},{"id":3117826,"file_name":"bgm.mp3","project_id":182520,"asset_id":113696,"created_at":"2020-08-21T10:46:41.718+08:00","updated_at":"2020-08-21T10:46:41.718+08:00"},{"id":3117753,"file_name":"2.png","project_id":182520,"asset_id":251528,"created_at":"2020-08-21T10:23:16.446+08:00","updated_at":"2020-08-21T10:23:16.446+08:00"},{"id":3117754,"file_name":"3.png","project_id":182520,"asset_id":251529,"created_at":"2020-08-21T10:23:16.447+08:00","updated_at":"2020-08-21T10:23:16.447+08:00"},{"id":3117771,"file_name":"k_1.png","project_id":182520,"asset_id":251545,"created_at":"2020-08-21T10:23:23.482+08:00","updated_at":"2020-08-21T10:23:23.482+08:00"},{"id":3117772,"file_name":"k_2.png","project_id":182520,"asset_id":251546,"created_at":"2020-08-21T10:23:23.484+08:00","updated_at":"2020-08-21T10:23:23.484+08:00"},{"id":3117759,"file_name":"12.png","project_id":182520,"asset_id":251534,"created_at":"2020-08-21T10:23:19.064+08:00","updated_at":"2020-08-21T10:23:19.064+08:00"},{"id":3117760,"file_name":"18.png","project_id":182520,"asset_id":251535,"created_at":"2020-08-21T10:23:19.065+08:00","updated_at":"2020-08-21T10:23:19.065+08:00"},{"id":3117763,"file_name":"36.png","project_id":182520,"asset_id":251538,"created_at":"2020-08-21T10:23:20.703+08:00","updated_at":"2020-08-21T10:23:20.703+08:00"},{"id":3117764,"file_name":"42.png","project_id":182520,"asset_id":251539,"created_at":"2020-08-21T10:23:20.704+08:00","updated_at":"2020-08-21T10:23:20.704+08:00"},{"id":3117777,"file_name":"p_0.png","project_id":182520,"asset_id":251551,"created_at":"2020-08-21T10:23:25.302+08:00","updated_at":"2020-08-21T10:23:25.302+08:00"},{"id":3117778,"file_name":"p_1.png","project_id":182520,"asset_id":251552,"created_at":"2020-08-21T10:23:25.303+08:00","updated_at":"2020-08-21T10:23:25.303+08:00"},{"id":3117761,"file_name":"24.png","project_id":182520,"asset_id":251536,"created_at":"2020-08-21T10:23:20.040+08:00","updated_at":"2020-08-21T10:23:20.040+08:00"},{"id":3117762,"file_name":"30.png","project_id":182520,"asset_id":251537,"created_at":"2020-08-21T10:23:20.042+08:00","updated_at":"2020-08-21T10:23:20.042+08:00"},{"id":3117825,"file_name":"cook.ogg","project_id":182520,"asset_id":175933,"created_at":"2020-08-21T10:46:38.888+08:00","updated_at":"2020-08-21T10:46:38.888+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦