{"id":760542,"student_id":10,"content":"from game import *\nfrom random import *\n\nset_backdrop('bg.png')\n\narr = []\nspeed = 1.01\nspace = speed ** 30\nreset = space ** 20\nclock = 0\n\ncar = create_sprite(\n 'car_0.png', 'car_1.png', 'car_2.png', 'car_1.png',\n 'car_3.png', 'car_4.png', 'car_5.png', 'car_4.png',\n 'car_6.png', 'car_7.png', 'car_8.png', 'car_7.png'\n)\ncar.y = 600\ncar.layer = 1\n\nrule = create_sprite('rule.png', 'gameover.png')\nrule.layer = 2\n\nscore = 0\n\nbgm = create_sound('bgm.ogg', True)\n\nfor y in range(20):\n for x in range(-5, 6):\n s = create_sprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png', 'b_6.png')\n s.scale = space ** y / 30\n s.x = 600 + s.scale * 600 * x\n s.y = 300\n if x == -4 or x == 4: s.costume_id = 1\n arr.append(s)\n\ndef loop():\n global clock, speed, score\n \n clock += 1\n car_animation()\n \n draw_text(str(score // 60) + 'm', 10, 10, 'black', 50)\n \n if rule.hidden:\n score += 1\n speed += 0.01 / 6000\n \n for s in arr:\n s.scale *= speed\n s.x = (s.x - 600) * speed + 600\n if s.scale \u003e= 2:\n s.scale /= reset\n s.x = (s.x - 600) / reset + 600\n if rule.hidden: random_item(s)\n \n s.layer = s.scale\n \n if key.left and arr[1].x \u003c 600: s.x += s.scale * 30\n if key.right and arr[9].x \u003e 600: s.x -= s.scale * 30\n if key.left or key.right: rule.hidden = True\n \n \n if s.scale \u003e 0.8 and s.scale \u003c 1.2 and s.x \u003e 600 - s.scale * 400 and s.x \u003c 400 + s.scale * 600 and s.costume_id \u003e 1:\n rule.costume_id = 1\n rule.hidden = False\n stop()\n\ndef car_animation():\n car.costume_id = (clock % 32) // 8\n if key.left: car.costume_id += 4\n elif key.right: car.costume_id += 8\n\ndef random_item(s):\n if s.costume_id != 1:\n s.costume_id = 0\n rand = random()\n if rand \u003c 0.050: s.costume_id = 2 + randint(0, 1)\n elif rand \u003c 0.055 and score \u003e 60 * 10: s.costume_id = 4\n elif rand \u003c 0.060 and score \u003e 60 * 20: s.costume_id = 5\n elif rand \u003c 0.075 and score \u003e 60 * 30: s.costume_id = 6\n \nforever(loop)","created_at":"2024-05-29T16:04:42.480+08:00","updated_at":"2024-07-23T15:39:29.926+08:00","name":"叩叮開農車","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/760542/de2c15472caeba2b8e9a3d35e6614a0d.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":51,"hashid":"d5msn5yz6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16980584,"file_name":"bgm.ogg","project_id":760542,"asset_id":744873,"created_at":"2024-05-29T16:06:55.043+08:00","updated_at":"2024-05-29T16:06:55.043+08:00"},{"id":17089261,"file_name":"car_1.png","project_id":760542,"asset_id":745092,"created_at":"2024-06-04T16:23:13.786+08:00","updated_at":"2024-06-04T16:23:13.786+08:00"},{"id":17089262,"file_name":"car_2.png","project_id":760542,"asset_id":745093,"created_at":"2024-06-04T16:23:13.789+08:00","updated_at":"2024-06-04T16:23:13.789+08:00"},{"id":17089253,"file_name":"b_2.png","project_id":760542,"asset_id":746605,"created_at":"2024-06-04T16:23:11.822+08:00","updated_at":"2024-06-04T16:23:11.822+08:00"},{"id":17089254,"file_name":"b_3.png","project_id":760542,"asset_id":746606,"created_at":"2024-06-04T16:23:11.824+08:00","updated_at":"2024-06-04T16:23:11.824+08:00"},{"id":17089255,"file_name":"b_4.png","project_id":760542,"asset_id":746607,"created_at":"2024-06-04T16:23:12.339+08:00","updated_at":"2024-06-04T16:23:12.339+08:00"},{"id":17089256,"file_name":"b_5.png","project_id":760542,"asset_id":746608,"created_at":"2024-06-04T16:23:12.340+08:00","updated_at":"2024-06-04T16:23:12.340+08:00"},{"id":17089323,"file_name":"bg.png","project_id":760542,"asset_id":743409,"created_at":"2024-06-04T17:35:26.862+08:00","updated_at":"2024-06-04T17:35:26.862+08:00"},{"id":17089251,"file_name":"b_0.png","project_id":760542,"asset_id":746603,"created_at":"2024-06-04T16:23:11.000+08:00","updated_at":"2024-06-04T16:23:11.000+08:00"},{"id":17089252,"file_name":"b_1.png","project_id":760542,"asset_id":746604,"created_at":"2024-06-04T16:23:11.002+08:00","updated_at":"2024-06-04T16:23:11.002+08:00"},{"id":17089257,"file_name":"b_6.png","project_id":760542,"asset_id":746609,"created_at":"2024-06-04T16:23:13.087+08:00","updated_at":"2024-06-04T16:23:13.087+08:00"},{"id":17089258,"file_name":"b_7.png","project_id":760542,"asset_id":746610,"created_at":"2024-06-04T16:23:13.089+08:00","updated_at":"2024-06-04T16:23:13.089+08:00"},{"id":17089260,"file_name":"car_0.png","project_id":760542,"asset_id":745091,"created_at":"2024-06-04T16:23:13.512+08:00","updated_at":"2024-06-04T16:23:13.512+08:00"},{"id":17089265,"file_name":"car_5.png","project_id":760542,"asset_id":745096,"created_at":"2024-06-04T16:23:14.348+08:00","updated_at":"2024-06-04T16:23:14.348+08:00"},{"id":17089266,"file_name":"car_6.png","project_id":760542,"asset_id":745097,"created_at":"2024-06-04T16:23:14.351+08:00","updated_at":"2024-06-04T16:23:14.351+08:00"},{"id":17089267,"file_name":"car_7.png","project_id":760542,"asset_id":745098,"created_at":"2024-06-04T16:23:14.634+08:00","updated_at":"2024-06-04T16:23:14.634+08:00"},{"id":17089268,"file_name":"car_8.png","project_id":760542,"asset_id":745099,"created_at":"2024-06-04T16:23:14.636+08:00","updated_at":"2024-06-04T16:23:14.636+08:00"},{"id":17089269,"file_name":"gameover.png","project_id":760542,"asset_id":745100,"created_at":"2024-06-04T16:23:15.007+08:00","updated_at":"2024-06-04T16:23:15.007+08:00"},{"id":17089270,"file_name":"rule.png","project_id":760542,"asset_id":745101,"created_at":"2024-06-04T16:23:15.009+08:00","updated_at":"2024-06-04T16:23:15.009+08:00"},{"id":17089263,"file_name":"car_3.png","project_id":760542,"asset_id":745094,"created_at":"2024-06-04T16:23:14.097+08:00","updated_at":"2024-06-04T16:23:14.097+08:00"},{"id":17089264,"file_name":"car_4.png","project_id":760542,"asset_id":745095,"created_at":"2024-06-04T16:23:14.099+08:00","updated_at":"2024-06-04T16:23:14.099+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦