{"id":23809,"student_id":1981,"content":"var speed = 0;\nvar startTime = Date.now();\nvar round = 0;\nvar target = 2;\n\nforever(function() {\n \n if (key.right) {\n speed-=0.1;\n //當右鍵被按下時\n car.direction += 3;\n }\n if(speed\u003c0.3){ //防止車子往反方向跑\n speed=0.3;\n }\n if (key.left) {\n //當左鍵被按下時\n speed-=0.1;\n car.direction -= 3;\n }\n if(car.touched(border)){ //判斷碰到草皮會做的事情\n speed-=0.1\n }\n if (car.touched(road)) {\n if (speed \u003c= 9) {\n speed += 0.1\n }\n } else {\n speed = 0.3\n }\n if(car.touched(check1) \u0026\u0026 target==1) { \n target=2;\n round+=1;\n } \n if(car.touched(check2) \u0026\u0026 target==2) { \n target=2;\n } \n if(round==2){ \n stop();\n }\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 +'/2',10,90,'red',20);\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// var speed = 0;\n// var startTime = Date.now();\n// var round = 0;\n// var target = 2;\n// forever(function(){\n// print((Date.now()-startTime)/1000 + 's', 10, 10, 'red', 20);//方法回傳自 1970/01/01 00:00:00 UTC 起經過的毫秒數\n// print(Math.floor(speed*10) + 'km/h', 10, 50, 'red', 20);//Math.floor()函式會回傳小於等於所給數字的最大整數。\n// print(round + '/2', 10, 90, 'red', 20);\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\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// target = 2;\n// round += 1;\n// }\n// if(car.touched(check2) \u0026\u0026 target == 2) {\n// target = 1;\n// }\n// if(round == 2) {\n// stop();\n// }\n\n// border.direction = car.direction - 180;\n// border.stepForward(speed);\n\n// road.direction = car.direction - 180;\n// road.stepForward(speed);\n\n// check1.direction = car.direction - 180;\n// check1.stepForward(speed);\n\n// check2.direction = car.direction - 180;\n// check2.stepForward(speed);\n// });","created_at":"2018-03-07T23:15:10.397+08:00","updated_at":"2020-12-23T20:03:03.150+08:00","name":"急速賽車","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/23809/ecacbcc56e43cf02c0df7b72b6543b65.jpg"},"parent_id":9146,"plugin":"var road = createSprite(\"road.png\");\nroad.rotationStyle = 'fixed';\nvar check1 = createSprite(\"check.png\");\ncheck1.x = -1200;\ncheck1.y = -400;\ncheck1.rotationStyle = \"fixed\";\nvar check2 = createSprite(\"check.png\");\ncheck2.x = 1130;\ncheck2.y = 300;\ncheck2.rotationStyle = \"fixed\";\nvar border= createSprite(\"border.png\");\nborder.rotationStyle = 'fixed';\nvar car = createSprite(\"car.png\");\ncar.scale = 0.4;\ncar.direction = 180;\n\nvar offsetX = 1500;\nvar offsetY = 650;\n\nroad.x += offsetX;\nroad.y += offsetY;\nborder.x += offsetX;\nborder.y += offsetY;\ncheck1.x += offsetX;\ncheck1.y += offsetY;\ncheck2.x += offsetX;\ncheck2.y += offsetY;","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":128,"hashid":"qmds3mzy","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":451855,"file_name":"car.png","project_id":23809,"asset_id":24181,"created_at":"2018-03-07T23:15:10.407+08:00","updated_at":"2018-03-07T23:15:10.407+08:00"},{"id":451856,"file_name":"border.png","project_id":23809,"asset_id":24182,"created_at":"2018-03-07T23:15:10.426+08:00","updated_at":"2018-03-07T23:15:10.426+08:00"},{"id":451857,"file_name":"road.png","project_id":23809,"asset_id":24183,"created_at":"2018-03-07T23:15:10.428+08:00","updated_at":"2018-03-07T23:15:10.428+08:00"},{"id":451858,"file_name":"check.png","project_id":23809,"asset_id":24184,"created_at":"2018-03-07T23:15:10.430+08:00","updated_at":"2018-03-07T23:15:10.430+08:00"},{"id":463964,"file_name":"F1.mp3","project_id":23809,"asset_id":57368,"created_at":"2018-03-16T22:31:54.750+08:00","updated_at":"2018-03-16T22:32:07.685+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦