{"id":889745,"student_id":10,"content":"from game import *\nfrom random import *\n\nnums = [f'{i}.png' for i in range(10)]\nbg1 = create_sprite('bg.png')\nplayer = create_sprite('player.png') #扣叮\nbg2 = create_sprite('bg_front.png') #前台\nn1 = create_sprite(nums) #千位分數\nn2 = create_sprite(nums) #百位分數\nn3 = create_sprite(nums) #十位分數\nn4 = create_sprite(nums) #個位分數\ninfo = create_sprite('rules.png') #遊戲說明\nresult = create_sprite('bg_success.png', 'bg_fail.png') #遊戲結果底圖\nbgm = create_sound('bgm.mp3', True) #背景音樂\n\nn1.move_to(40, 50)\nn2.move_to(90, 50)\nn3.move_to(140, 50)\nn4.move_to(190, 50)\nplayer.move_to(600, 475)\n\nitems = [] #存放墜落食材\nresults = [] #存放碗裡食材\nscore = 0 #分數\nspeed = 1 #速度\n\nscore_table = [5, 15, 15, 3, 3, 3, 3, 3, 0, 0, 0]\n\nfor i in range(11):\n s = create_sprite(f's_{i}.png')\n items.append(s)\n s = create_sprite(f'l_{i}.png')\n results.append(s)\n\n#重新開始\ndef reset():\n global score, speed\n \n # 如果拉麵製作失敗重新開始就恢復分數\n if result.costume_id == 1: score = 0\n \n speed = 1 + score / 500 #隨著分數加快速度\n \n result.hidden = True #隱藏結果圖\n player.move_to(600, 475) #重置叩叮位置\n bgm.set_volume(1) #恢復音量\n \n for s in items:\n s.hidden = False\n s.x = random() * 1000 + 100\n s.y = random() * -3000 - 100\n s.vy = random() * 3 + 3\n \n for s in results:\n s.hidden = True\n\n# #遊戲主迴圈\ndef loop():\n if info.hidden:\n update_player() #更新叩叮\n update_items() #更新食材\n update_score() #更新分數\n elif key.space:\n info.hidden = True #隱藏說明開始遊戲\n \n#更新叩叮\ndef update_player():\n if key.right: player.x += 15 * speed\n if key.left: player.x -= 15 * speed\n if key.space and not result.hidden: reset()\n \n#移動食材\ndef update_items():\n global score\n is_pass = True #所有食材是否都超出場景下方\n for i in range(11):\n s = items[i]\n s.y += s.vy * speed\n s.direction += 1\n if not s.hidden and abs(player.x - s.x) \u003c 100 and abs(player.y - s.y) \u003c 50:\n s.hidden = True\n score += score_table[i]\n create_sound('splash.mp3')\n if s.y \u003c 1000: is_pass = False\n \n if is_pass: show_result() #如果所有食材超出下方就顯示結果\n \n#顯示結果\ndef show_result():\n bgm.set_volume(0.02) #降低音量\n for i in range(11):\n results[i].hidden = not items[i].hidden\n \n result.hidden = False #顯示結果圖\n if items[8].hidden or items[9].hidden or items[10].hidden or not items[0].hidden:\n result.costume_id = 1\n else:\n result.costume_id = 0\n\n\n#更新分數\ndef update_score():\n n1.costume_id = (score // 1000) % 10 #千位數\n n2.costume_id = (score // 100) % 10 #百位數\n n3.costume_id = (score // 10) % 10 #十位數\n n4.costume_id = (score // 1) % 10 #個位數\n \nforever(loop)\nreset()\n\n","created_at":"2024-11-19T13:31:14.091+08:00","updated_at":"2024-11-19T14:13:43.805+08:00","name":"拉麵配料王_完整版","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/889745/8c9702c4a79f5605db837fc513cf544c.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":2,"hashid":"36ysj2mk8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":34599119,"file_name":"bg_front.png","project_id":889745,"asset_id":793288,"created_at":"2024-11-19T13:54:07.092+08:00","updated_at":"2024-11-19T13:54:07.092+08:00"},{"id":34599072,"file_name":"0.png","project_id":889745,"asset_id":793245,"created_at":"2024-11-19T13:31:25.813+08:00","updated_at":"2024-11-19T13:31:25.813+08:00"},{"id":34599073,"file_name":"1.png","project_id":889745,"asset_id":793246,"created_at":"2024-11-19T13:31:25.817+08:00","updated_at":"2024-11-19T13:31:25.817+08:00"},{"id":34599074,"file_name":"bg.png","project_id":889745,"asset_id":793247,"created_at":"2024-11-19T13:31:25.823+08:00","updated_at":"2024-11-19T13:31:25.823+08:00"},{"id":34599075,"file_name":"bowl.png","project_id":889745,"asset_id":793248,"created_at":"2024-11-19T13:31:25.828+08:00","updated_at":"2024-11-19T13:31:25.828+08:00"},{"id":34599076,"file_name":"l_4.png","project_id":889745,"asset_id":793249,"created_at":"2024-11-19T13:31:25.831+08:00","updated_at":"2024-11-19T13:31:25.831+08:00"},{"id":34599077,"file_name":"l_5.png","project_id":889745,"asset_id":793250,"created_at":"2024-11-19T13:31:25.835+08:00","updated_at":"2024-11-19T13:31:25.835+08:00"},{"id":34599078,"file_name":"2.png","project_id":889745,"asset_id":793251,"created_at":"2024-11-19T13:31:25.839+08:00","updated_at":"2024-11-19T13:31:25.839+08:00"},{"id":34599079,"file_name":"3.png","project_id":889745,"asset_id":793252,"created_at":"2024-11-19T13:31:25.843+08:00","updated_at":"2024-11-19T13:31:25.843+08:00"},{"id":34599080,"file_name":"bg_success.png","project_id":889745,"asset_id":793253,"created_at":"2024-11-19T13:31:25.848+08:00","updated_at":"2024-11-19T13:31:25.848+08:00"},{"id":34599081,"file_name":"s_5.png","project_id":889745,"asset_id":793254,"created_at":"2024-11-19T13:31:25.852+08:00","updated_at":"2024-11-19T13:31:25.852+08:00"},{"id":34599082,"file_name":"s_6.png","project_id":889745,"asset_id":793255,"created_at":"2024-11-19T13:31:25.855+08:00","updated_at":"2024-11-19T13:31:25.855+08:00"},{"id":34599083,"file_name":"4.png","project_id":889745,"asset_id":793256,"created_at":"2024-11-19T13:31:25.859+08:00","updated_at":"2024-11-19T13:31:25.859+08:00"},{"id":34599084,"file_name":"5.png","project_id":889745,"asset_id":793257,"created_at":"2024-11-19T13:31:25.862+08:00","updated_at":"2024-11-19T13:31:25.862+08:00"},{"id":34599085,"file_name":"l_2.png","project_id":889745,"asset_id":793258,"created_at":"2024-11-19T13:31:25.866+08:00","updated_at":"2024-11-19T13:31:25.866+08:00"},{"id":34599086,"file_name":"l_3.png","project_id":889745,"asset_id":793259,"created_at":"2024-11-19T13:31:25.870+08:00","updated_at":"2024-11-19T13:31:25.870+08:00"},{"id":34599087,"file_name":"6.png","project_id":889745,"asset_id":793260,"created_at":"2024-11-19T13:31:25.874+08:00","updated_at":"2024-11-19T13:31:25.874+08:00"},{"id":34599088,"file_name":"7.png","project_id":889745,"asset_id":793261,"created_at":"2024-11-19T13:31:25.878+08:00","updated_at":"2024-11-19T13:31:25.878+08:00"},{"id":34599089,"file_name":"l_0.png","project_id":889745,"asset_id":793262,"created_at":"2024-11-19T13:31:25.882+08:00","updated_at":"2024-11-19T13:31:25.882+08:00"},{"id":34599090,"file_name":"l_1.png","project_id":889745,"asset_id":793263,"created_at":"2024-11-19T13:31:25.886+08:00","updated_at":"2024-11-19T13:31:25.886+08:00"},{"id":34599091,"file_name":"l_8.png","project_id":889745,"asset_id":793264,"created_at":"2024-11-19T13:31:25.890+08:00","updated_at":"2024-11-19T13:31:25.890+08:00"},{"id":34599092,"file_name":"l_9.png","project_id":889745,"asset_id":793265,"created_at":"2024-11-19T13:31:25.893+08:00","updated_at":"2024-11-19T13:31:25.893+08:00"},{"id":34599093,"file_name":"s_7.png","project_id":889745,"asset_id":793266,"created_at":"2024-11-19T13:31:25.897+08:00","updated_at":"2024-11-19T13:31:25.897+08:00"},{"id":34599094,"file_name":"s_8.png","project_id":889745,"asset_id":793267,"created_at":"2024-11-19T13:31:25.901+08:00","updated_at":"2024-11-19T13:31:25.901+08:00"},{"id":34599095,"file_name":"conver.png","project_id":889745,"asset_id":793268,"created_at":"2024-11-19T13:31:25.929+08:00","updated_at":"2024-11-19T13:31:25.929+08:00"},{"id":34599096,"file_name":"bg_fail.png","project_id":889745,"asset_id":793269,"created_at":"2024-11-19T13:31:25.935+08:00","updated_at":"2024-11-19T13:31:25.935+08:00"},{"id":34599097,"file_name":"l_6.png","project_id":889745,"asset_id":793270,"created_at":"2024-11-19T13:31:25.939+08:00","updated_at":"2024-11-19T13:31:25.939+08:00"},{"id":34599098,"file_name":"l_7.png","project_id":889745,"asset_id":793271,"created_at":"2024-11-19T13:31:25.942+08:00","updated_at":"2024-11-19T13:31:25.942+08:00"},{"id":34599099,"file_name":"s_3.png","project_id":889745,"asset_id":793272,"created_at":"2024-11-19T13:31:25.946+08:00","updated_at":"2024-11-19T13:31:25.946+08:00"},{"id":34599100,"file_name":"s_4.png","project_id":889745,"asset_id":793273,"created_at":"2024-11-19T13:31:25.950+08:00","updated_at":"2024-11-19T13:31:25.950+08:00"},{"id":34599101,"file_name":"s_9.png","project_id":889745,"asset_id":793274,"created_at":"2024-11-19T13:31:25.954+08:00","updated_at":"2024-11-19T13:31:25.954+08:00"},{"id":34599102,"file_name":"s_10.png","project_id":889745,"asset_id":793275,"created_at":"2024-11-19T13:31:25.957+08:00","updated_at":"2024-11-19T13:31:25.957+08:00"},{"id":34599103,"file_name":"s_0.png","project_id":889745,"asset_id":793276,"created_at":"2024-11-19T13:31:25.961+08:00","updated_at":"2024-11-19T13:31:25.961+08:00"},{"id":34599104,"file_name":"s_1.png","project_id":889745,"asset_id":793277,"created_at":"2024-11-19T13:31:25.965+08:00","updated_at":"2024-11-19T13:31:25.965+08:00"},{"id":34599105,"file_name":"s_2.png","project_id":889745,"asset_id":793278,"created_at":"2024-11-19T13:31:25.968+08:00","updated_at":"2024-11-19T13:31:25.968+08:00"},{"id":34599106,"file_name":"8.png","project_id":889745,"asset_id":793279,"created_at":"2024-11-19T13:31:25.972+08:00","updated_at":"2024-11-19T13:31:25.972+08:00"},{"id":34599107,"file_name":"9.png","project_id":889745,"asset_id":793280,"created_at":"2024-11-19T13:31:25.976+08:00","updated_at":"2024-11-19T13:31:25.976+08:00"},{"id":34599108,"file_name":"l_10.png","project_id":889745,"asset_id":793281,"created_at":"2024-11-19T13:31:25.980+08:00","updated_at":"2024-11-19T13:31:25.980+08:00"},{"id":34599109,"file_name":"player.png","project_id":889745,"asset_id":793282,"created_at":"2024-11-19T13:31:25.983+08:00","updated_at":"2024-11-19T13:31:25.983+08:00"},{"id":34599110,"file_name":"rules.png","project_id":889745,"asset_id":793283,"created_at":"2024-11-19T13:31:25.991+08:00","updated_at":"2024-11-19T13:31:25.991+08:00"},{"id":34599111,"file_name":"splash.mp3","project_id":889745,"asset_id":793284,"created_at":"2024-11-19T13:31:25.995+08:00","updated_at":"2024-11-19T13:31:25.995+08:00"},{"id":34599112,"file_name":"bgm.mp3","project_id":889745,"asset_id":793285,"created_at":"2024-11-19T13:31:26.043+08:00","updated_at":"2024-11-19T13:31:26.043+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦