{"id":655569,"student_id":10,"content":"import game #載入遊戲框架\nimport random #載入產生隨機數的套件\n\ngame.set_backdrop('bg.jpg') #設定背景圖\n\nanswer = random.randrange(1, 101) #產生 1-100 的隨機整數\nlow = 0 #範圍下界\nhigh = 101 #範圍上界\n\ngame.create_sound('bgm.mp3', True)\n\ndef onclick():\n global low, high #存取函式外部的變數\n \n #取得使用者的輸入\n guess = int(input('請輸入 1-100 的數字?'))\n \n print('ok!')\n \n if guess == answer: #如果猜的跟答一樣大\n game.set_backdrop('bingo.jpg')\n low = answer\n high = answer\n game.stop()\n game.create_sound('bingo.mp3')\n \n if guess \u003e answer: #如果猜的比答案大\n game.set_backdrop('too_high.jpg')\n high = guess\n game.create_sound('lol.mp3')\n \n if guess \u003c answer: #如果猜的比答案小\n game.set_backdrop('too_low.jpg')\n low = guess\n game.create_sound('lol.mp3')\n\n#遊戲迴圈\ndef loop():\n # game.draw_text(answer, 10, 10, 'white', 90)\n game.draw_text(low, 320, 680, 'black', 90)\n game.draw_text(high, 750, 680, 'black', 90)\n\ngame.forever(loop) #重複不斷執行遊戲迴圈\ngame.on('click', onclick) #點擊遊戲場景時執行 onclick 函式\n\n","created_at":"2023-12-05T10:41:12.622+08:00","updated_at":"2024-11-13T16:05:21.357+08:00","name":"終極密碼 - 開始後用滑鼠點擊舞台以啟用按鍵,重整畫面即可重新遊戲。 副本","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/655569/6d69db2104e77c0cf176e0e226be607d.jpg"},"parent_id":194475,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":74,"hashid":"6rpsq35k6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":14710461,"file_name":"bg.jpg","project_id":655569,"asset_id":267906,"created_at":"2023-12-05T10:41:12.628+08:00","updated_at":"2023-12-05T10:41:12.628+08:00"},{"id":14710462,"file_name":"too_low.jpg","project_id":655569,"asset_id":267907,"created_at":"2023-12-05T10:41:12.630+08:00","updated_at":"2023-12-05T10:41:12.630+08:00"},{"id":14710463,"file_name":"too_high.jpg","project_id":655569,"asset_id":267908,"created_at":"2023-12-05T10:41:12.631+08:00","updated_at":"2023-12-05T10:41:12.631+08:00"},{"id":14710464,"file_name":"bingo.jpg","project_id":655569,"asset_id":267909,"created_at":"2023-12-05T10:41:12.632+08:00","updated_at":"2023-12-05T10:41:12.632+08:00"},{"id":14710465,"file_name":"bgm.mp3","project_id":655569,"asset_id":267910,"created_at":"2023-12-05T10:41:12.633+08:00","updated_at":"2023-12-05T10:41:12.633+08:00"},{"id":14710466,"file_name":"lol.mp3","project_id":655569,"asset_id":267911,"created_at":"2023-12-05T10:41:12.635+08:00","updated_at":"2023-12-05T10:41:12.635+08:00"},{"id":14710467,"file_name":"bingo.mp3","project_id":655569,"asset_id":267912,"created_at":"2023-12-05T10:41:12.636+08:00","updated_at":"2023-12-05T10:41:12.636+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦