{"id":801388,"student_id":10,"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 fq = 30 - clock // 60\n \n # 隨機改變公牛和牛仔的角度\n if space.hidden and clock % fq == 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\n if boy.direction == 0 or boy.direction == 180:\n space.hidden = False\n \n if not space.hidden and boy.y \u003c 700:\n boy.y += 5\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-07-26T10:22:17.482+08:00","updated_at":"2024-08-12T15:30:04.475+08:00","name":"騎公牛大賽_完整版","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/801388/12b73aa0227028c00d9d4259460d573a.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":41,"hashid":"d5ms9yk9g","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17749349,"file_name":"boy.png","project_id":801388,"asset_id":758728,"created_at":"2024-07-26T13:42:00.653+08:00","updated_at":"2024-07-26T13:42:00.653+08:00"},{"id":17749350,"file_name":"cow_0.png","project_id":801388,"asset_id":758729,"created_at":"2024-07-26T13:42:00.661+08:00","updated_at":"2024-07-26T13:42:00.661+08:00"},{"id":17749351,"file_name":"0.png","project_id":801388,"asset_id":758730,"created_at":"2024-07-26T13:42:00.665+08:00","updated_at":"2024-07-26T13:42:00.665+08:00"},{"id":17749352,"file_name":"1.png","project_id":801388,"asset_id":758731,"created_at":"2024-07-26T13:42:00.669+08:00","updated_at":"2024-07-26T13:42:00.669+08:00"},{"id":17749353,"file_name":"6.png","project_id":801388,"asset_id":758732,"created_at":"2024-07-26T13:42:00.673+08:00","updated_at":"2024-07-26T13:42:00.673+08:00"},{"id":17749354,"file_name":"7.png","project_id":801388,"asset_id":758733,"created_at":"2024-07-26T13:42:00.677+08:00","updated_at":"2024-07-26T13:42:00.677+08:00"},{"id":17749355,"file_name":"space.png","project_id":801388,"asset_id":758734,"created_at":"2024-07-26T13:42:00.682+08:00","updated_at":"2024-07-26T13:42:00.682+08:00"},{"id":17749356,"file_name":"rule.png","project_id":801388,"asset_id":758735,"created_at":"2024-07-26T13:42:00.688+08:00","updated_at":"2024-07-26T13:42:00.688+08:00"},{"id":17749357,"file_name":"8.png","project_id":801388,"asset_id":758736,"created_at":"2024-07-26T13:42:00.691+08:00","updated_at":"2024-07-26T13:42:00.691+08:00"},{"id":17749358,"file_name":"9.png","project_id":801388,"asset_id":758737,"created_at":"2024-07-26T13:42:00.696+08:00","updated_at":"2024-07-26T13:42:00.696+08:00"},{"id":17749359,"file_name":"dot.png","project_id":801388,"asset_id":758738,"created_at":"2024-07-26T13:42:00.700+08:00","updated_at":"2024-07-26T13:42:00.700+08:00"},{"id":17749360,"file_name":"sec.png","project_id":801388,"asset_id":758739,"created_at":"2024-07-26T13:42:00.704+08:00","updated_at":"2024-07-26T13:42:00.704+08:00"},{"id":17749361,"file_name":"cow_1.png","project_id":801388,"asset_id":758740,"created_at":"2024-07-26T13:42:00.709+08:00","updated_at":"2024-07-26T13:42:00.709+08:00"},{"id":17749362,"file_name":"cow_2.png","project_id":801388,"asset_id":758741,"created_at":"2024-07-26T13:42:00.715+08:00","updated_at":"2024-07-26T13:42:00.715+08:00"},{"id":17749363,"file_name":"4.png","project_id":801388,"asset_id":758742,"created_at":"2024-07-26T13:42:00.719+08:00","updated_at":"2024-07-26T13:42:00.719+08:00"},{"id":17749364,"file_name":"5.png","project_id":801388,"asset_id":758743,"created_at":"2024-07-26T13:42:00.723+08:00","updated_at":"2024-07-26T13:42:00.723+08:00"},{"id":17749365,"file_name":"bg.png","project_id":801388,"asset_id":758744,"created_at":"2024-07-26T13:42:00.730+08:00","updated_at":"2024-07-26T13:42:00.730+08:00"},{"id":17749366,"file_name":"2.png","project_id":801388,"asset_id":758745,"created_at":"2024-07-26T13:42:00.734+08:00","updated_at":"2024-07-26T13:42:00.734+08:00"},{"id":17749367,"file_name":"3.png","project_id":801388,"asset_id":758746,"created_at":"2024-07-26T13:42:00.738+08:00","updated_at":"2024-07-26T13:42:00.738+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦