{"id":202897,"student_id":10,"content":"import game #載入遊戲套件\nimport time #載入時間套件\n\nroad = game.create_sprite('road_1.png') #賽道\ncheck1 = game.create_sprite('end.png') #檢查點1\ncheck2 = game.create_sprite('end.png') #檢查點1\nground = game.create_sprite('ground_1.png') #背景柏油路圖\ncover = game.create_sprite('cover.png') #背景柏油路圖\n\ncheck1.y = 150\ncheck2.y = 750\n\np1 = game.create_sprite('car_red.png') #p1紅色賽車\np1.x = 500\np1.y = 130\np1_speed = 0 # p1 車速\np1_round = 0 # p1 完成半圈數\np1_timer = 0 # p1 花費時間\n\np2 = game.create_sprite('car_orange.png') #p2橘色賽車\np2.x = 500\np2.y = 150\np2_speed = 0 # p2 車速\np2_round = 0 # p2 完成半圈數\np2_timer = 0 # p2 花費時間\n\np3 = game.create_sprite('car_white.png') #p3白色賽車\np3.x = 500\np3.y = 170\np3_speed = 0 # p3 車速\np3_round = 0 # p3 完成半圈數\np3_timer = 0 # p3 花費時間\n\nstart_time = time.time()\n\ngame.create_sound('bgm.mp3')\n\ndef p1_loop():\n global p1_speed, p1_round, p1_timer\n \n p1.step_forward(p1_speed)\n \n if game.key.right:\n p1.direction += 2\n p1_speed -= 0.03\n \n if game.key.left:\n p1.direction -= 2\n p1_speed -= 0.03\n \n if game.key.up and p1_round \u003c 3:\n p1_speed += 0.1\n \n if p1_speed \u003e 0:\n p1_speed -= 0.01\n \n if p1.touched(ground):\n p1_speed = 0.3\n \n if p1.touched(check2) and p1_round % 1 == 0:\n p1_round += 0.5\n \n if p1.touched(check1) and p1_round % 1 == 0.5:\n p1_round += 0.5\n \n if p1_round \u003c 2:\n p1_timer = int(time.time() - start_time)\n \n game.draw_text(p1_round, 10, 10, 'black', 30)\n game.draw_text(p1_timer, 50, 10, 'black', 30)\n\n\ndef p2_loop():\n global p2_speed, p2_round, p2_timer\n \n p2.step_forward(p2_speed)\n \n if game.key.d:\n p2.direction += 2\n p2_speed -= 0.03\n \n if game.key.a:\n p2.direction -= 2\n p2_speed -= 0.03\n \n if game.key.w and p2_round \u003c 3:\n p2_speed += 0.1\n \n if p2_speed \u003e 0:\n p2_speed -= 0.01\n \n if p2.touched(ground):\n p2_speed = 0.3\n \n if p2.touched(check2) and p2_round % 1 == 0:\n p2_round += 0.5\n \n if p2.touched(check1) and p2_round % 1 == 0.5:\n p2_round += 0.5\n \n if p2_round \u003c 2:\n p2_timer = int(time.time() - start_time)\n \n game.draw_text(p2_round, 10, 40, 'black', 30)\n game.draw_text(p2_timer, 50, 40, 'black', 30)\n\n\ndef p3_loop():\n global p3_speed, p3_round, p3_timer\n \n p3.step_forward(p3_speed)\n \n if game.key.k:\n p3.direction += 2\n p3_speed -= 0.03\n \n if game.key.h:\n p3.direction -= 2\n p3_speed -= 0.03\n \n if game.key.u and p3_round \u003c 3:\n p3_speed += 0.1\n \n if p3_speed \u003e 0:\n p3_speed -= 0.01\n \n if p3.touched(ground):\n p3_speed = 0.3\n \n if p3.touched(check2) and p3_round % 1 == 0:\n p2_round += 0.5\n \n if p3.touched(check1) and p3_round % 1 == 0.5:\n p2_round += 0.5\n \n if p3_round \u003c 2:\n p3_timer = int(time.time() - start_time)\n \n game.draw_text(p3_round, 10, 70, 'black', 30)\n game.draw_text(p3_timer, 50, 70, 'black', 30)\n\n\ngame.forever(p1_loop)\ngame.forever(p2_loop)\ngame.forever(p3_loop)\n","created_at":"2020-11-10T11:57:21.412+08:00","updated_at":"2024-10-30T16:25:10.549+08:00","name":"迷你賽車(完整版)","language":"python","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/202897/c7b65a0dfca4f8422087f73dd85d2b48.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":207,"hashid":"882sqy6qg","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3638357,"file_name":"cover.png","project_id":202897,"asset_id":289579,"created_at":"2020-12-04T13:36:36.278+08:00","updated_at":"2020-12-04T13:36:36.278+08:00"},{"id":3638358,"file_name":"end.png","project_id":202897,"asset_id":289580,"created_at":"2020-12-04T13:36:36.279+08:00","updated_at":"2020-12-04T13:36:36.279+08:00"},{"id":3638367,"file_name":"car_red.png","project_id":202897,"asset_id":289589,"created_at":"2020-12-04T13:37:52.538+08:00","updated_at":"2020-12-04T13:37:52.538+08:00"},{"id":3638368,"file_name":"car_white.png","project_id":202897,"asset_id":289590,"created_at":"2020-12-04T13:37:52.539+08:00","updated_at":"2020-12-04T13:37:52.539+08:00"},{"id":3638365,"file_name":"car_green.png","project_id":202897,"asset_id":289587,"created_at":"2020-12-04T13:37:51.919+08:00","updated_at":"2020-12-04T13:37:51.919+08:00"},{"id":3638366,"file_name":"car_orange.png","project_id":202897,"asset_id":289588,"created_at":"2020-12-04T13:37:51.920+08:00","updated_at":"2020-12-04T13:37:51.920+08:00"},{"id":3678825,"file_name":"ground_1.png","project_id":202897,"asset_id":291500,"created_at":"2020-12-09T15:43:10.769+08:00","updated_at":"2020-12-09T15:43:10.769+08:00"},{"id":3678826,"file_name":"ground_2.png","project_id":202897,"asset_id":291501,"created_at":"2020-12-09T15:43:10.771+08:00","updated_at":"2020-12-09T15:43:10.771+08:00"},{"id":3678827,"file_name":"ground_3.png","project_id":202897,"asset_id":291502,"created_at":"2020-12-09T15:43:11.814+08:00","updated_at":"2020-12-09T15:43:11.814+08:00"},{"id":3678828,"file_name":"road_1.png","project_id":202897,"asset_id":291503,"created_at":"2020-12-09T15:43:11.816+08:00","updated_at":"2020-12-09T15:43:11.816+08:00"},{"id":3678829,"file_name":"road_2.png","project_id":202897,"asset_id":291504,"created_at":"2020-12-09T15:43:13.288+08:00","updated_at":"2020-12-09T15:43:13.288+08:00"},{"id":3678830,"file_name":"road_3.png","project_id":202897,"asset_id":291505,"created_at":"2020-12-09T15:43:13.290+08:00","updated_at":"2020-12-09T15:43:13.290+08:00"},{"id":3719304,"file_name":"bgm.mp3","project_id":202897,"asset_id":293311,"created_at":"2020-12-15T11:12:54.927+08:00","updated_at":"2020-12-15T11:12:59.384+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦