{"id":183077,"student_id":10,"content":"/**\n * 情境:老師我的程式無法執行...\n * 提示:當自己花過多時間在排除問題時,可以試著用終極註解法\n */\n\nvar speed = 0; //車速\nvar startTime = Date.now(); //開始時間\nvar round = 0; //圈數\nvar target = 2; //目標物\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 + '/2', 10, 90, 'red', 20);\n \n //當玩家按下右鍵\n if(key.right) {\n car.direction += 3; //車子右轉\n speed -= 0.11; \n }\n \n //當玩家按下左鍵\n if(key.left) {\n car.direction -= 3; //車子左轉\n speed -= 0.11;\n }\n \n //車速上限\n if(speed \u003c 9) {\n speed += 0.08;\n }\n \n //當車子撞到邊界時減速\n if(car.touched(border)) {\n speed -= 0.13;\n }\n \n //車子最低怠速\n if (speed \u003c 0.3) {\n speed = 0.3; \n }\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","created_at":"2020-08-19T20:25:56.433+08:00","updated_at":"2022-11-02T15:09:55.673+08:00","name":"L5_瘋狂賽車_除錯範例 副本","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/183077/ab042a2f78582a869f1f7d13c751fc75.jpg"},"parent_id":183004,"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":386,"hashid":"wdksdk5q","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3114284,"file_name":"car.png","project_id":183077,"asset_id":127542,"created_at":"2020-08-19T20:25:56.439+08:00","updated_at":"2020-08-19T20:25:56.439+08:00"},{"id":3114285,"file_name":"border.png","project_id":183077,"asset_id":127543,"created_at":"2020-08-19T20:25:56.440+08:00","updated_at":"2020-08-19T20:25:56.440+08:00"},{"id":3114286,"file_name":"road.png","project_id":183077,"asset_id":127544,"created_at":"2020-08-19T20:25:56.442+08:00","updated_at":"2020-08-19T20:25:56.442+08:00"},{"id":3114287,"file_name":"check.png","project_id":183077,"asset_id":127545,"created_at":"2020-08-19T20:25:56.443+08:00","updated_at":"2020-08-19T20:25:56.443+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer