{"id":863579,"student_id":1981,"content":"from game import *\nfrom random import *\n\nnums = [str(i) + '.png' for i in range(10)] #建立 0-9 數字圖片名稱\nbg = create_sprite('bg.png') #背景\ncow = create_sprite('cow_2.png', 'cow_1.png', 'cow_0.png') #公牛\nboy = create_sprite('boy.png') #牛仔\nn1 = create_sprite(nums) #百位數\nn2 = create_sprite(nums) #十位數\nn3 = create_sprite(nums) #個位數\nsec = create_sprite('sec.png') #秒數單位\nrules = create_sprite('rule.png') #遊戲說明\nspace = create_sprite('space.png') #空白鍵\nn1.move_to(100, 100)\nn2.move_to(150, 100)\nn3.move_to(200, 100)\nsec.move_to(280, 110)\n\nclock = 0\n\ndef reset():\n global clock\n clock = 0 #重置時間\n boy.y = 450 #重置牛仔垂直位置\n boy.direction = 90 #重置牛仔角度\n space.hidden = True #隱藏空白鍵\n rules.hidden = True #隱藏說明圖\n\ndef loop():\n global clock\n clock += 1\n \n if space.hidden:\n update_clock() #更新時間\n update_scene() #更新場景\n \n # 隨機改變公牛和牛仔的角度\n if space.hidden and clock % 30 == 0:\n if cow.direction == 90:\n if random() \u003e 0.5:\n cow.direction += 30\n boy.direction += 30\n else:\n cow.direction -= 30\n boy.direction -= 30\n else:\n cow.direction = 90\n\ndef update_clock():\n sec = clock // 60\n n1.costume_id = (sec // 100) % 10 #更新百位數\n n2.costume_id = (sec // 10) % 10 #更新十位數\n n3.costume_id = (sec // 1) % 10 #更新個位數\n\n# 背景捲動和牛的造型\ndef update_scene():\n bg.x += 1\n if bg.x \u003e= 1200: bg.x -= 1200\n cow.costume_id = (clock // 15) % 3\n\n# 按下右鍵牛仔向右旋轉 30 度\ndef key_right():\n if space.hidden: boy.direction += 30\n\n# 按下左鍵牛仔向右旋轉 30 度\ndef key_left():\n if space.hidden: boy.direction -= 30\n \non('keydown', 'right', key_right)\non('keydown', 'left', key_left)\non('keydown', 'space', reset)\nforever(loop)\n","created_at":"2024-10-15T16:11:05.740+08:00","updated_at":"2024-10-15T17:48:46.007+08:00","name":"5_騎公牛大賽_預設版 副本","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/863579/d7c5cbadb5765f4fd6ba04077ce19242.jpg"},"parent_id":829986,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":3,"hashid":"yeys4m549","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":18911707,"file_name":"boy.png","project_id":863579,"asset_id":771651,"created_at":"2024-10-15T16:11:05.746+08:00","updated_at":"2024-10-15T16:11:05.746+08:00"},{"id":18911708,"file_name":"cow_0.png","project_id":863579,"asset_id":771652,"created_at":"2024-10-15T16:11:05.747+08:00","updated_at":"2024-10-15T16:11:05.747+08:00"},{"id":18911709,"file_name":"0.png","project_id":863579,"asset_id":771653,"created_at":"2024-10-15T16:11:05.748+08:00","updated_at":"2024-10-15T16:11:05.748+08:00"},{"id":18911710,"file_name":"1.png","project_id":863579,"asset_id":771654,"created_at":"2024-10-15T16:11:05.749+08:00","updated_at":"2024-10-15T16:11:05.749+08:00"},{"id":18911711,"file_name":"6.png","project_id":863579,"asset_id":771655,"created_at":"2024-10-15T16:11:05.750+08:00","updated_at":"2024-10-15T16:11:05.750+08:00"},{"id":18911712,"file_name":"7.png","project_id":863579,"asset_id":771656,"created_at":"2024-10-15T16:11:05.751+08:00","updated_at":"2024-10-15T16:11:05.751+08:00"},{"id":18911713,"file_name":"space.png","project_id":863579,"asset_id":771657,"created_at":"2024-10-15T16:11:05.752+08:00","updated_at":"2024-10-15T16:11:05.752+08:00"},{"id":18911714,"file_name":"rule.png","project_id":863579,"asset_id":771658,"created_at":"2024-10-15T16:11:05.753+08:00","updated_at":"2024-10-15T16:11:05.753+08:00"},{"id":18911715,"file_name":"8.png","project_id":863579,"asset_id":771659,"created_at":"2024-10-15T16:11:05.754+08:00","updated_at":"2024-10-15T16:11:05.754+08:00"},{"id":18911716,"file_name":"9.png","project_id":863579,"asset_id":771660,"created_at":"2024-10-15T16:11:05.755+08:00","updated_at":"2024-10-15T16:11:05.755+08:00"},{"id":18911717,"file_name":"dot.png","project_id":863579,"asset_id":771661,"created_at":"2024-10-15T16:11:05.756+08:00","updated_at":"2024-10-15T16:11:05.756+08:00"},{"id":18911718,"file_name":"sec.png","project_id":863579,"asset_id":771662,"created_at":"2024-10-15T16:11:05.757+08:00","updated_at":"2024-10-15T16:11:05.757+08:00"},{"id":18911719,"file_name":"cow_1.png","project_id":863579,"asset_id":771663,"created_at":"2024-10-15T16:11:05.758+08:00","updated_at":"2024-10-15T16:11:05.758+08:00"},{"id":18911720,"file_name":"cow_2.png","project_id":863579,"asset_id":771664,"created_at":"2024-10-15T16:11:05.759+08:00","updated_at":"2024-10-15T16:11:05.759+08:00"},{"id":18911721,"file_name":"4.png","project_id":863579,"asset_id":771665,"created_at":"2024-10-15T16:11:05.760+08:00","updated_at":"2024-10-15T16:11:05.760+08:00"},{"id":18911722,"file_name":"5.png","project_id":863579,"asset_id":771666,"created_at":"2024-10-15T16:11:05.761+08:00","updated_at":"2024-10-15T16:11:05.761+08:00"},{"id":18911723,"file_name":"bg.png","project_id":863579,"asset_id":771667,"created_at":"2024-10-15T16:11:05.762+08:00","updated_at":"2024-10-15T16:11:05.762+08:00"},{"id":18911724,"file_name":"2.png","project_id":863579,"asset_id":771668,"created_at":"2024-10-15T16:11:05.763+08:00","updated_at":"2024-10-15T16:11:05.763+08:00"},{"id":18911725,"file_name":"3.png","project_id":863579,"asset_id":771669,"created_at":"2024-10-15T16:11:05.763+08:00","updated_at":"2024-10-15T16:11:05.763+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦