{"id":183242,"student_id":10,"content":"var road = createSprite('road.png'); //柏油路背景\nvar check1 = createSprite('check.png'); //檢查點1\nvar check2 = createSprite('check.png'); //檢查點2\nvar border = createSprite('border.png'); //道路邊界\nvar car = createSprite('car.png'); //車子\nvar dashboard = createSprite('dashboard.png'); //儀表板\nvar resultBoard = createSprite('result.png'); //成績顯示版\nvar miniRoad = createSprite('road.png'); //迷你地圖\nvar miniCar = createSprite('car.png'); //迷你車\n\ncheck1.moveTo(600, 400);\ncheck2.moveTo(600, -1750);\nminiRoad.moveTo(1000, 700);\nminiCar.moveTo(1000, 700);\n\n//固定圖片不會隨角度旋轉\nroad.rotationStyle = 'fixed';\ncheck1.rotationStyle = 'fixed';\ncheck2.rotationStyle = 'fixed';\nborder.rotationStyle = 'fixed';\n\nminiCar.scale = 1/2; //縮小車子\nminiRoad.scale = 1/15; //縮小地圖\nminiRoad.opacity = 0.6; //迷你地圖半透明\n\nresultBoard.hidden = true; //預設隱藏成績顯示版\n\nvar speed = 0; //車速\nvar startTime = Date.now(); //開始時間\nvar round = 1; //圈數\nvar isChecked = false; //是否經過檢查點2\nvar timer = 0; //計時器\nvar t1; //第1圈秒數\nvar t2; //第2圈秒數\nvar t3; //第3圈秒數\n\ncreateSound('bgm.mp3', true);\nvar engineSound = createSound('engine.mp3', true);\n\nforever(loop); //重複不斷執行遊戲迴圈\n\n//遊戲主迴圈\nfunction loop () {\n \n timer = (Date.now() - startTime)/1000;\n\n print(Math.floor(speed*10) + ' km/h', 80, 80, 'white', 40);\n print(round + '/3', 350, 80, 'black', 40);\n print(timer + 's', 1000, 80, 'white', 40);\n\n engineSound.setVolume(speed/10); //根據速度調整引擎聲音\n\n //相對移動\n border.direction = car.direction - 180;\n border.stepForward(speed);\n road.direction = car.direction - 180;\n road.stepForward(speed);\n check1.direction = car.direction - 180;\n check1.stepForward(speed);\n check2.direction = car.direction - 180;\n check2.stepForward(speed);\n\n if (key.right) {\n car.direction += 2;\n speed -= 0.2;\n }\n if (key.left) {\n car.direction -= 2;\n speed -= 0.2;\n }\n if (speed \u003c 12) {\n speed += 0.15;\n }\n if (car.touched(border)) {\n speed -= 0.3;\n }\n if (speed \u003c 0.6) {\n speed = 0.6;\n }\n if (car.touched(check1) \u0026\u0026 isChecked) {\n startTime = Date.now();\n if (round == 1) {\n t1 = timer;\n }\n if (round == 2) {\n t2 = timer;\n }\n if (round == 3) {\n t3 = timer;\n }\n round += 1;\n isChecked = false;\n }\n if (car.touched(check2)) {\n isChecked = true;\n }\n \n //進入第四圈表示已經完成三圈,遊戲要結束並顯示成績\n if (round == 4) {\n resultBoard.hidden = false;\n var avg = (t1 + t2 + t3) / 3;\n drawText(t1 + 's', 550, 340, 'white', 30);\n drawText(t2 + 's', 550, 410, 'white', 30);\n drawText(t3 + 's', 550, 495, 'white', 30);\n drawText(avg.toFixed(3) + 's', 550, 560, 'white', 30);\n stop();\n }\n \n //迷你小地圖\n miniCar.direction = car.direction;\n miniCar.stepForward(speed/15);\n\n}","created_at":"2020-08-20T13:56:00.632+08:00","updated_at":"2020-10-13T14:33:46.195+08:00","name":"瘋狂賽車(完整版)","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/183242/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":144073,"plugin":"Game.set({\n width: 1200, height: 900,\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":226,"hashid":"4y3s4m6v","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3116334,"file_name":"road.png","project_id":183242,"asset_id":251410,"created_at":"2020-08-20T13:56:00.637+08:00","updated_at":"2020-08-20T13:56:00.637+08:00"},{"id":3116335,"file_name":"result.png","project_id":183242,"asset_id":218342,"created_at":"2020-08-20T13:56:00.638+08:00","updated_at":"2020-08-20T13:56:00.638+08:00"},{"id":3116336,"file_name":"dashboard.png","project_id":183242,"asset_id":209197,"created_at":"2020-08-20T13:56:00.639+08:00","updated_at":"2020-08-20T13:56:00.639+08:00"},{"id":3116337,"file_name":"check.png","project_id":183242,"asset_id":218341,"created_at":"2020-08-20T13:56:00.640+08:00","updated_at":"2020-08-20T13:56:00.640+08:00"},{"id":3116338,"file_name":"car.png","project_id":183242,"asset_id":209195,"created_at":"2020-08-20T13:56:00.641+08:00","updated_at":"2020-08-20T13:56:00.641+08:00"},{"id":3116339,"file_name":"border.png","project_id":183242,"asset_id":251408,"created_at":"2020-08-20T13:56:00.642+08:00","updated_at":"2020-08-20T13:56:00.642+08:00"},{"id":3116340,"file_name":"bgm.mp3","project_id":183242,"asset_id":172358,"created_at":"2020-08-20T13:56:00.643+08:00","updated_at":"2020-08-20T13:56:00.643+08:00"},{"id":3116341,"file_name":"engine.mp3","project_id":183242,"asset_id":205224,"created_at":"2020-08-20T13:56:00.644+08:00","updated_at":"2020-08-20T13:56:00.644+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦