{"id":830357,"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# create_sound('bgm.mp3', True)\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-08-29T17:51:53.066+08:00","updated_at":"2024-08-29T17:56:33.407+08:00","name":"5_騎公牛大賽_預設版","language":"python","screenshot":{"url":null},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":30,"hashid":"36ysj59q8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":18269768,"file_name":"boy.png","project_id":830357,"asset_id":772185,"created_at":"2024-08-29T17:56:30.108+08:00","updated_at":"2024-08-29T17:56:30.108+08:00"},{"id":18269769,"file_name":"cow_0.png","project_id":830357,"asset_id":772186,"created_at":"2024-08-29T17:56:30.112+08:00","updated_at":"2024-08-29T17:56:30.112+08:00"},{"id":18269770,"file_name":"0.png","project_id":830357,"asset_id":772187,"created_at":"2024-08-29T17:56:30.116+08:00","updated_at":"2024-08-29T17:56:30.116+08:00"},{"id":18269771,"file_name":"1.png","project_id":830357,"asset_id":772188,"created_at":"2024-08-29T17:56:30.120+08:00","updated_at":"2024-08-29T17:56:30.120+08:00"},{"id":18269772,"file_name":"6.png","project_id":830357,"asset_id":772189,"created_at":"2024-08-29T17:56:30.124+08:00","updated_at":"2024-08-29T17:56:30.124+08:00"},{"id":18269773,"file_name":"7.png","project_id":830357,"asset_id":772190,"created_at":"2024-08-29T17:56:30.128+08:00","updated_at":"2024-08-29T17:56:30.128+08:00"},{"id":18269774,"file_name":"space.png","project_id":830357,"asset_id":772191,"created_at":"2024-08-29T17:56:30.131+08:00","updated_at":"2024-08-29T17:56:30.131+08:00"},{"id":18269775,"file_name":"rule.png","project_id":830357,"asset_id":772192,"created_at":"2024-08-29T17:56:30.136+08:00","updated_at":"2024-08-29T17:56:30.136+08:00"},{"id":18269776,"file_name":"8.png","project_id":830357,"asset_id":772193,"created_at":"2024-08-29T17:56:30.140+08:00","updated_at":"2024-08-29T17:56:30.140+08:00"},{"id":18269777,"file_name":"9.png","project_id":830357,"asset_id":772194,"created_at":"2024-08-29T17:56:30.144+08:00","updated_at":"2024-08-29T17:56:30.144+08:00"},{"id":18269778,"file_name":"dot.png","project_id":830357,"asset_id":772195,"created_at":"2024-08-29T17:56:30.147+08:00","updated_at":"2024-08-29T17:56:30.147+08:00"},{"id":18269779,"file_name":"sec.png","project_id":830357,"asset_id":772196,"created_at":"2024-08-29T17:56:30.151+08:00","updated_at":"2024-08-29T17:56:30.151+08:00"},{"id":18269780,"file_name":"cow_1.png","project_id":830357,"asset_id":772197,"created_at":"2024-08-29T17:56:30.156+08:00","updated_at":"2024-08-29T17:56:30.156+08:00"},{"id":18269781,"file_name":"cow_2.png","project_id":830357,"asset_id":772198,"created_at":"2024-08-29T17:56:30.160+08:00","updated_at":"2024-08-29T17:56:30.160+08:00"},{"id":18269782,"file_name":"4.png","project_id":830357,"asset_id":772199,"created_at":"2024-08-29T17:56:30.164+08:00","updated_at":"2024-08-29T17:56:30.164+08:00"},{"id":18269783,"file_name":"5.png","project_id":830357,"asset_id":772200,"created_at":"2024-08-29T17:56:30.168+08:00","updated_at":"2024-08-29T17:56:30.168+08:00"},{"id":18269784,"file_name":"bg.png","project_id":830357,"asset_id":772201,"created_at":"2024-08-29T17:56:30.174+08:00","updated_at":"2024-08-29T17:56:30.174+08:00"},{"id":18269785,"file_name":"2.png","project_id":830357,"asset_id":772202,"created_at":"2024-08-29T17:56:30.178+08:00","updated_at":"2024-08-29T17:56:30.178+08:00"},{"id":18269786,"file_name":"3.png","project_id":830357,"asset_id":772203,"created_at":"2024-08-29T17:56:30.181+08:00","updated_at":"2024-08-29T17:56:30.181+08:00"},{"id":18269787,"file_name":"bgm.mp3","project_id":830357,"asset_id":772184,"created_at":"2024-08-29T17:56:40.968+08:00","updated_at":"2024-08-29T17:56:40.968+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦