{"id":824146,"student_id":10,"content":"from game import *\n\nbg = create_sprite('bg.png') #背景\nrabbit = create_sprite('rabbit.png') #兔子\nturtle = create_sprite('turtle.png') #烏龜\n\ndef loop():\n # 烏龜或兔子超過範圍就和背景一起向左捲動\n if turtle.x \u003e 650 or rabbit.x \u003e 650:\n turtle.x -= 10\n rabbit.x -= 10\n bg.x -= 10\n if bg.x \u003c 0: bg.x += 2400 #重置背景\n \n if turtle.x \u003e rabbit.x:\n draw_text('烏龜超前!', 30, 30, 'black', 40)\n \n if turtle.x \u003c rabbit.x:\n draw_text('兔子超前!', 30, 30, 'black', 40)\n \n if turtle.x == rabbit.x:\n draw_text('雙方勢均力敵!', 30, 30, 'black', 40)\n\ndef turtle_move():\n turtle.x += 50\n \ndef rabbit_move():\n rabbit.x += 50\n\non('keydown', 'space', turtle_move) #空白鍵烏龜向右移動\non('keydown', 'enter', rabbit_move) #enter 鍵兔子向右移動\nforever(loop)","created_at":"2024-08-20T12:19:03.956+08:00","updated_at":"2024-08-20T14:01:19.668+08:00","name":"龜兔賽跑_預設版","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/824146/f6df03801427ef673385db65349d913b.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":48,"hashid":"2pdsppdn9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":18157009,"file_name":"rabbit.png","project_id":824146,"asset_id":768643,"created_at":"2024-08-20T12:19:20.456+08:00","updated_at":"2024-08-20T12:19:20.456+08:00"},{"id":18157010,"file_name":"turtle.png","project_id":824146,"asset_id":768644,"created_at":"2024-08-20T12:19:20.457+08:00","updated_at":"2024-08-20T12:19:20.457+08:00"},{"id":18157008,"file_name":"bg.png","project_id":824146,"asset_id":768642,"created_at":"2024-08-20T12:19:16.459+08:00","updated_at":"2024-08-20T12:19:16.459+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦