{"id":140644,"student_id":10,"content":"var road = createSprite(\"bg.png\");\nvar check1 = createSprite(\"check.png\");\nvar check2 = createSprite(\"check.png\");\nvar border= createSprite(\"road.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;\n// var offsetX = 2800;\n// var offsetY = 1300;\n// road.x += offsetX;\n// road.y += offsetY;\n// border.x += offsetX;\n// border.y += offsetY;\n// check1.x += offsetX;\n// check1.y += offsetY;\n// check2.x += offsetX;\n// check2.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-15T09:15:06.950+08:00","updated_at":"2020-04-15T09:16:38.103+08:00","name":"急速賽車_雙師 v3","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/140644/d981b79075b42d43194e7a5215883601.jpg"},"parent_id":140541,"plugin":"Game.set({\n width: 1200, height: 900,\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":233,"hashid":"9ygs65wg","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2427401,"file_name":"bgm.mp3","project_id":140644,"asset_id":172358,"created_at":"2020-04-15T09:15:06.956+08:00","updated_at":"2020-04-15T09:15:06.956+08:00"},{"id":2427402,"file_name":"engine.mp3","project_id":140644,"asset_id":205224,"created_at":"2020-04-15T09:15:06.957+08:00","updated_at":"2020-04-15T09:15:06.957+08:00"},{"id":2427403,"file_name":"car.png","project_id":140644,"asset_id":205222,"created_at":"2020-04-15T09:15:06.958+08:00","updated_at":"2020-04-15T09:15:06.958+08:00"},{"id":2427404,"file_name":"check.png","project_id":140644,"asset_id":205221,"created_at":"2020-04-15T09:15:06.959+08:00","updated_at":"2020-04-15T09:15:06.959+08:00"},{"id":2427407,"file_name":"bg.png","project_id":140644,"asset_id":205744,"created_at":"2020-04-15T09:15:23.639+08:00","updated_at":"2020-04-15T09:15:23.639+08:00"},{"id":2427408,"file_name":"road.png","project_id":140644,"asset_id":205745,"created_at":"2020-04-15T09:15:23.641+08:00","updated_at":"2020-04-15T09:15:23.641+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦