{"id":203233,"student_id":12205,"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 (key.up) {\n if (speed \u003c 12) {\n speed += 0.15;\n }\n } else {\n speed -= 0.03;\n }\n if (key.down) {\n if (speed \u003e 0.6) {\n speed -= 0.3;\n }\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-11-13T20:32:04.788+08:00","updated_at":"2024-06-04T11:09:44.792+08:00","name":"瘋狂賽車(完整版) 副本","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/203233/19468e86dc135539ac50cbfb59bf0847.jpg"},"parent_id":183242,"plugin":"Game.set({\n width: 1200, height: 900,\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":46,"hashid":"jzmseyg58","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3511209,"file_name":"engine.mp3","project_id":203233,"asset_id":205224,"created_at":"2020-11-13T20:32:04.794+08:00","updated_at":"2020-11-13T20:32:04.794+08:00"},{"id":3511210,"file_name":"bgm.mp3","project_id":203233,"asset_id":172358,"created_at":"2020-11-13T20:32:04.796+08:00","updated_at":"2020-11-13T20:32:04.796+08:00"},{"id":3511211,"file_name":"border.png","project_id":203233,"asset_id":251408,"created_at":"2020-11-13T20:32:04.797+08:00","updated_at":"2020-11-13T20:32:04.797+08:00"},{"id":3511212,"file_name":"car.png","project_id":203233,"asset_id":209195,"created_at":"2020-11-13T20:32:04.799+08:00","updated_at":"2020-11-13T20:32:04.799+08:00"},{"id":3511213,"file_name":"check.png","project_id":203233,"asset_id":218341,"created_at":"2020-11-13T20:32:04.800+08:00","updated_at":"2020-11-13T20:32:04.800+08:00"},{"id":3511214,"file_name":"dashboard.png","project_id":203233,"asset_id":209197,"created_at":"2020-11-13T20:32:04.801+08:00","updated_at":"2020-11-13T20:32:04.801+08:00"},{"id":3511215,"file_name":"result.png","project_id":203233,"asset_id":218342,"created_at":"2020-11-13T20:32:04.802+08:00","updated_at":"2020-11-13T20:32:04.802+08:00"},{"id":3511216,"file_name":"road.png","project_id":203233,"asset_id":251410,"created_at":"2020-11-13T20:32:04.803+08:00","updated_at":"2020-11-13T20:32:04.803+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦