{"id":140541,"student_id":10,"content":"var road = createSprite(\"bg.png\");\nvar check1 = createSprite(\"check.png\");\nvar check2 = createSprite(\"check.png\");\nvar border= createSprite(\"border.png\");\nvar car = createSprite(\"car.png\");\n\nvar speed = 0;\nvar startTime = Date.now();\nvar round = 1;\nvar target = 2;\nvar t1 = 0;\nvar t2 = 0;\nvar t3 = 0;\n\nroad.rotationStyle = 'fixed';\ncheck1.rotationStyle = \"fixed\";\ncheck2.rotationStyle = \"fixed\";\nborder.rotationStyle = 'fixed';\n\ncheck1.moveTo(-2200, -800);\ncheck2.moveTo(2150, 600);\n\ncreateSound('bgm.mp3', true);\nvar engineSound = createSound('engine.mp3', true);\n\n//--------------- 重新設計素材後這裏會省略 ---------------//\ncar.direction = 180;\nvar offsetX = 2800;\nvar offsetY = 1300;\nroad.x += offsetX;\nroad.y += offsetY;\nborder.x += offsetX;\nborder.y += offsetY;\ncheck1.x += offsetX;\ncheck1.y += offsetY;\ncheck2.x += offsetX;\ncheck2.y += offsetY;\n//-------------------------------------------------------//\n\n\nforever(loop);\n\nfunction loop () {\n print((Date.now()-startTime)/1000 + 's', 10, 10, 'red', 30);\n print(Math.floor(speed*10) + 'km/h', 10, 50, 'red', 30);\n print(round + '/3', 10, 90, 'red', 30);\n \n engineSound.setVolume(speed/10);\n \n if(key.right) {\n car.direction += 3;\n speed -= 0.2;\n }\n if(key.left) {\n car.direction -= 3;\n speed -= 0.2;\n }\n if(speed \u003c 20) {\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 target == 1) {\n var time = Date.now() - startTime;\n startTime = Date.now();\n if (round == 1) {\n t1 = time;\n }\n if (round == 2) {\n t2 = time;\n }\n if (round == 3) {\n t3 = time;\n }\n target = 2;\n round += 1;\n }\n if(car.touched(check2) \u0026\u0026 target == 2) {\n target = 1;\n }\n if(round == 4) {\n var avg = (t1 + t2 + t3)/3;\n drawText(t1, 100, 100);\n drawText(t2, 100, 200);\n drawText(t3, 100, 300);\n drawText(avg, 100, 400);\n stop();\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};","created_at":"2020-04-13T13:39:34.318+08:00","updated_at":"2020-04-14T10:40:29.766+08:00","name":"急速賽車_雙師 v2","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/140541/f262eeae28bb8ce4e018f616403d2d6a.jpg"},"parent_id":2,"plugin":"Game.set({\n width: 1200, height: 900,\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":232,"hashid":"yeysjgdm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2425321,"file_name":"check.png","project_id":140541,"asset_id":205221,"created_at":"2020-04-13T13:43:34.083+08:00","updated_at":"2020-04-13T13:43:34.083+08:00"},{"id":2425322,"file_name":"car.png","project_id":140541,"asset_id":205222,"created_at":"2020-04-13T13:43:34.085+08:00","updated_at":"2020-04-13T13:43:34.085+08:00"},{"id":2425319,"file_name":"border.png","project_id":140541,"asset_id":205219,"created_at":"2020-04-13T13:43:33.874+08:00","updated_at":"2020-04-13T13:43:33.874+08:00"},{"id":2425320,"file_name":"bg.png","project_id":140541,"asset_id":205220,"created_at":"2020-04-13T13:43:33.876+08:00","updated_at":"2020-04-13T13:43:33.876+08:00"},{"id":2425382,"file_name":"engine.mp3","project_id":140541,"asset_id":205224,"created_at":"2020-04-13T15:06:12.532+08:00","updated_at":"2020-04-13T15:06:12.532+08:00"},{"id":2425383,"file_name":"bgm.mp3","project_id":140541,"asset_id":172358,"created_at":"2020-04-13T15:06:21.352+08:00","updated_at":"2020-04-13T15:06:21.352+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦