{"id":4720,"student_id":888,"content":"setBackdrop(\"#777\");\n\nvar speed = 0; // 車子當前速度\nvar power = 2; // 加速度\nvar maxSpeed = 180; // 最高速\nvar slow = 3; // 過彎減速\nvar friction = 3; // 草皮摩擦力\nvar round = 0; // 當前圈數\nvar target = 3; // 目標圈數\nvar pass = 0; // 紀錄總圈數時間\nvar oneRoundTime = 0; // 紀錄單趟時間\nvar startTime = new Date().getTime();\n\nvar checkPoint = Game.createSprite({\n\tx: 310,\n y: 120,\n scale: 0.6,\n costumes: \"indy_winner.jpg\"\n});\n\ncheckPoint.rotationStyle = 'fixed';\n\nvar road = Game.createSprite({\n \tx: 1600,\n \ty: -100,\n scale: 1,\n\tcostumes: \"秋名山賽道.png\"\n});\nroad.rotationStyle = 'fixed';\n\nvar dash = Game.createSprite({\n \tx: 1600,\n \ty: -100,\n scale: 1,\n\tcostumes: \"秋名山賽道_中線.png\"\n});\ndash.rotationStyle = 'fixed';\n\nvar car = Game.createSprite({\n\tx: 320,\n y: 240,\n scale: 0.2,\n costumes: \"86.png\"\n});\ncar.direction = 0;\n\ncar.on('touch',[road], function() {\n var base = 3;\n if(speed \u003e= friction + base) {\n speed -= friction;\n } else {\n speed = base;\n }\n});\n\nvar lastCheckTime = 0;\ncar.on('touch', [checkPoint], function() {\n\tvar now = new Date().getTime();\n if(now \u003e lastCheckTime + 20000) {\n \tlastCheckTime = now;\n if(round \u003e= 1) {\n console.log('第' + round + '圈花費時間:' + (pass - oneRoundTime) + 's');\n oneRoundTime = pass;\n }\n if(round == target) {\n console.log('總圈數花費:' + pass + '秒');\n \talert('花費:' + pass + '秒');\n }\n round += 1;\n }\n});\n\nGame.on('holding','left', function() {\n\tcar.direction -= 3;\n speed -= slow;\n});\n\nGame.on('holding','right', function() {\n\tcar.direction += 3;\n speed -= slow;\n});\n\nGame.forever(function() {\n \n if(round \u003e= target + 1) {\n \t\tGame.stop();\n }\n \n pass = (new Date().getTime() - startTime )/1000;\n pass = pass.toFixed(1);\n \n if(speed \u003c maxSpeed) speed += power;\n var direction = car.direction - 180;\n road.direction = direction;\n road.stepForward(speed / 20);\n dash.direction = direction;\n dash.stepForward(speed / 20);\n checkPoint.direction = direction;\n checkPoint.stepForward(speed / 20);\n \n Game.print(speed + ' km/h', 0, 0, 'red', 30);\n Game.print(round + '/' + target + 'rounds', 500, 0, 'red', 30);\n Game.print(pass + 's', 0, 100, 'red', 30);\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2025-02-15T10:02:44.317+08:00","name":"秋名山道練習","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/4720/a03f5eb5d0e6ca16458561bb5b4119de.jpg"},"parent_id":2,"plugin":"","description":"操作方法:方向鍵","note":null,"status":"public","like_student_ids":[10,1936,1935,1644,888,1984,4675,10956,12179,16868,12472,12466,43026,17411,43039,47766,71626,54704,55325,34483,41228,59680,58913,78005,91030,51196,77263,48676,46083,70354,70356,53173,72383,60745,67626,51321,77557,77517,53354,91478],"is_featured":true,"views":4621,"hashid":"qmdsejy","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":129018,"file_name":"car_red.png","project_id":4720,"asset_id":15697,"created_at":"2017-05-15T15:18:54.969+08:00","updated_at":"2017-05-15T15:18:54.969+08:00"},{"id":129019,"file_name":"car_black.png","project_id":4720,"asset_id":15698,"created_at":"2017-05-15T15:18:54.971+08:00","updated_at":"2017-05-15T15:18:54.971+08:00"},{"id":129020,"file_name":"car_3_blue.png","project_id":4720,"asset_id":15699,"created_at":"2017-05-15T15:18:54.974+08:00","updated_at":"2017-05-15T15:18:54.974+08:00"},{"id":129021,"file_name":"indy_winner.jpg","project_id":4720,"asset_id":15700,"created_at":"2017-05-15T15:18:54.977+08:00","updated_at":"2017-05-15T15:18:54.977+08:00"},{"id":129022,"file_name":"86.png","project_id":4720,"asset_id":15701,"created_at":"2017-05-15T15:18:54.980+08:00","updated_at":"2017-05-15T15:18:54.980+08:00"},{"id":129023,"file_name":"秋名山賽道_中線.png","project_id":4720,"asset_id":15702,"created_at":"2017-05-15T15:18:54.983+08:00","updated_at":"2017-05-15T15:18:54.983+08:00"},{"id":129024,"file_name":"秋名山賽道.png","project_id":4720,"asset_id":15703,"created_at":"2017-05-15T15:18:54.986+08:00","updated_at":"2017-05-15T15:18:54.986+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦