{"id":730837,"student_id":10,"content":"from game import *\nfrom random import *\n\nnums = ['0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png']\nbg = create_sprite('bg.png')\nnum1 = create_sprite(nums)\nnum2 = create_sprite(nums)\nnum3 = create_sprite(nums)\nsec = create_sprite('sec.png')\ncow = create_sprite('cow_0.png', 'cow_1.png', 'cow_2.png', 'cow_1.png')\nboy = create_sprite('boy_0.png')\ninfo = create_sprite('rules.png')\nspace = create_sprite('end.png')\nbgm = create_sound('bgm.mp3', True)\n\nnum1.move_to(100, 100)\nnum2.move_to(150, 100)\nnum3.move_to(200, 100)\nsec.move_to(280, 110)\n\nclock = 0\n\ndef start_game():\n global clock\n cow.direction = 90\n boy.direction = 90\n boy.y = 450\n clock = 0\n info.hidden = True\n space.hidden = True\n bgm.set_volume(1)\n\ndef loop():\n global clock\n \n if not info.hidden: return\n \n level = clock // 60\n if level \u003e 25: level = 25\n if space.hidden: clock += 1\n sec = clock // 60\n num1.costume_id = (sec // 100) % 10\n num2.costume_id = (sec // 10) % 10\n num3.costume_id = (sec // 1) % 10\n cow.costume_id = (clock // 20) % 4\n \n if space.hidden:\n bg.x += 3\n if bg.x \u003e 1200: bg.x -= 1200\n \n if clock % (30 - level) == 0 and space.hidden:\n if cow.direction == 90:\n if random() \u003c 0.5:\n if random () \u003c 0.5:\n cow.direction += 30\n boy.direction += 30\n create_sound('jump.wav')\n else:\n cow.direction -= 30\n boy.direction -= 30\n create_sound('jump.wav')\n else:\n cow.direction = 90\n \n if boy.direction \u003c= 0 or boy.direction \u003e= 180:\n space.hidden = False\n info.costume_id = 1\n cow.direction = 90\n bgm.set_volume(0)\n \n if not space.hidden and boy.y \u003c 800:\n boy.y += 5\n\ndef key_right():\n if space.hidden:\n boy.direction += 15\n create_sound('jump.wav')\n\ndef key_left():\n if space.hidden:\n boy.direction -= 15\n create_sound('jump.wav')\n\ninfo.on('click', start_game)\non('keyup', 'right', key_right)\non('keyup', 'left', key_left)\non('keyup', 'space', start_game)\nforever(loop)\n\n\n","created_at":"2024-04-16T09:37:48.817+08:00","updated_at":"2024-07-30T15:55:26.373+08:00","name":"騎公牛大賽","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/730837/ca9347e73258d08e2665ff165b0d0bb2.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":155,"hashid":"rdvsvkqd2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16332545,"file_name":"2.png","project_id":730837,"asset_id":734280,"created_at":"2024-04-16T09:38:17.102+08:00","updated_at":"2024-04-16T09:38:17.102+08:00"},{"id":16332546,"file_name":"3.png","project_id":730837,"asset_id":734281,"created_at":"2024-04-16T09:38:17.103+08:00","updated_at":"2024-04-16T09:38:17.103+08:00"},{"id":16332559,"file_name":"dot.png","project_id":730837,"asset_id":734294,"created_at":"2024-04-16T09:38:21.364+08:00","updated_at":"2024-04-16T09:38:21.364+08:00"},{"id":16332560,"file_name":"end.png","project_id":730837,"asset_id":732559,"created_at":"2024-04-16T09:38:21.365+08:00","updated_at":"2024-04-16T09:38:21.365+08:00"},{"id":16332557,"file_name":"cow_1.png","project_id":730837,"asset_id":734292,"created_at":"2024-04-16T09:38:20.959+08:00","updated_at":"2024-04-16T09:38:20.959+08:00"},{"id":16332558,"file_name":"cow_2.png","project_id":730837,"asset_id":734293,"created_at":"2024-04-16T09:38:20.961+08:00","updated_at":"2024-04-16T09:38:20.961+08:00"},{"id":16332561,"file_name":"rules.png","project_id":730837,"asset_id":734295,"created_at":"2024-04-16T09:38:22.237+08:00","updated_at":"2024-04-16T09:38:22.237+08:00"},{"id":16332562,"file_name":"sec.png","project_id":730837,"asset_id":734296,"created_at":"2024-04-16T09:38:22.240+08:00","updated_at":"2024-04-16T09:38:22.240+08:00"},{"id":16332555,"file_name":"boy_0.png","project_id":730837,"asset_id":734290,"created_at":"2024-04-16T09:38:20.379+08:00","updated_at":"2024-04-16T09:38:20.379+08:00"},{"id":16332556,"file_name":"cow_0.png","project_id":730837,"asset_id":734291,"created_at":"2024-04-16T09:38:20.381+08:00","updated_at":"2024-04-16T09:38:20.381+08:00"},{"id":16332543,"file_name":"0.png","project_id":730837,"asset_id":734278,"created_at":"2024-04-16T09:38:16.717+08:00","updated_at":"2024-04-16T09:38:16.717+08:00"},{"id":16332544,"file_name":"1.png","project_id":730837,"asset_id":734279,"created_at":"2024-04-16T09:38:16.719+08:00","updated_at":"2024-04-16T09:38:16.719+08:00"},{"id":16332549,"file_name":"6.png","project_id":730837,"asset_id":734284,"created_at":"2024-04-16T09:38:17.876+08:00","updated_at":"2024-04-16T09:38:17.876+08:00"},{"id":16332550,"file_name":"7.png","project_id":730837,"asset_id":734285,"created_at":"2024-04-16T09:38:17.878+08:00","updated_at":"2024-04-16T09:38:17.878+08:00"},{"id":16332570,"file_name":"jump2.wav","project_id":730837,"asset_id":333647,"created_at":"2024-04-16T10:28:25.995+08:00","updated_at":"2024-04-16T10:28:25.995+08:00"},{"id":16332547,"file_name":"4.png","project_id":730837,"asset_id":734282,"created_at":"2024-04-16T09:38:17.506+08:00","updated_at":"2024-04-16T09:38:17.506+08:00"},{"id":16332548,"file_name":"5.png","project_id":730837,"asset_id":734283,"created_at":"2024-04-16T09:38:17.509+08:00","updated_at":"2024-04-16T09:38:17.509+08:00"},{"id":16332571,"file_name":"jump3.wav","project_id":730837,"asset_id":734298,"created_at":"2024-04-16T10:29:07.171+08:00","updated_at":"2024-04-16T10:29:07.171+08:00"},{"id":16332553,"file_name":"all.png","project_id":730837,"asset_id":734288,"created_at":"2024-04-16T09:38:19.692+08:00","updated_at":"2024-04-16T09:38:19.692+08:00"},{"id":16332554,"file_name":"bg.png","project_id":730837,"asset_id":734289,"created_at":"2024-04-16T09:38:19.694+08:00","updated_at":"2024-04-16T09:38:19.694+08:00"},{"id":16332551,"file_name":"8.png","project_id":730837,"asset_id":734286,"created_at":"2024-04-16T09:38:18.274+08:00","updated_at":"2024-04-16T09:38:18.274+08:00"},{"id":16332552,"file_name":"9.png","project_id":730837,"asset_id":734287,"created_at":"2024-04-16T09:38:18.276+08:00","updated_at":"2024-04-16T09:38:18.276+08:00"},{"id":16332569,"file_name":"bgm.mp3","project_id":730837,"asset_id":734297,"created_at":"2024-04-16T10:26:43.544+08:00","updated_at":"2024-04-16T10:26:43.544+08:00"},{"id":16332568,"file_name":"jump.wav","project_id":730837,"asset_id":333645,"created_at":"2024-04-16T10:25:55.650+08:00","updated_at":"2024-04-16T10:25:55.650+08:00"},{"id":16867248,"file_name":"space.png","project_id":730837,"asset_id":732559,"created_at":"2024-05-21T11:34:23.029+08:00","updated_at":"2024-05-21T11:34:23.029+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦