{"id":140540,"student_id":10,"content":"var road = createSprite(\"road.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(-1200, -400);\ncheck2.moveTo(1130, 300);\n\ncreateSound('bgm.mp3', true);\nvar engineSound = createSound('engine.mp3', true);\n\n//--------------- 重新設計素材後這裏會省略 ---------------//\ncar.scale = 0.4;\ncar.direction = 180;\nvar offsetX = 1500;\nvar offsetY = 650;\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\n\nforever(function(){\n print((Date.now()-startTime)/1000 + 's', 10, 10, 'red', 20);\n print(Math.floor(speed*10) + 'km/h', 10, 50, 'red', 20);\n print(round + '/3', 10, 90, 'red', 20);\n \n engineSound.setVolume(speed/10);\n \n if(key.right) {\n car.direction += 3;\n speed -= 0.11;\n }\n if(key.left) {\n car.direction -= 3;\n speed -= 0.11;\n }\n if(speed \u003c 9) {\n speed += 0.08;\n }\n if(car.touched(border)) {\n speed -= 0.13;\n }\n if(speed \u003c 0.3) {\n speed = 0.3; \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:11:45.357+08:00","updated_at":"2020-04-13T15:01:56.672+08:00","name":"急速賽車_雙師 v1","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/140540/516ab5daa1416dfeb1f37d22080057b3.jpg"},"parent_id":9144,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":240,"hashid":"4y3s8kyp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2425381,"file_name":"engine.mp3","project_id":140540,"asset_id":205224,"created_at":"2020-04-13T15:01:49.411+08:00","updated_at":"2020-04-13T15:01:49.411+08:00"},{"id":2425379,"file_name":"bgm.mp3","project_id":140540,"asset_id":172358,"created_at":"2020-04-13T14:54:08.887+08:00","updated_at":"2020-04-13T14:54:08.887+08:00"},{"id":2425311,"file_name":"car.png","project_id":140540,"asset_id":24181,"created_at":"2020-04-13T13:11:45.363+08:00","updated_at":"2020-04-13T13:11:45.363+08:00"},{"id":2425312,"file_name":"border.png","project_id":140540,"asset_id":24182,"created_at":"2020-04-13T13:11:45.364+08:00","updated_at":"2020-04-13T13:11:45.364+08:00"},{"id":2425313,"file_name":"road.png","project_id":140540,"asset_id":24183,"created_at":"2020-04-13T13:11:45.366+08:00","updated_at":"2020-04-13T13:11:45.366+08:00"},{"id":2425314,"file_name":"check.png","project_id":140540,"asset_id":24184,"created_at":"2020-04-13T13:11:45.367+08:00","updated_at":"2020-04-13T13:11:45.367+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦