{"id":197238,"student_id":12205,"content":"alert('賽車遊戲即將開始')\nsetBackdrop(\"backdrop.png\")\nvar speed = 0;\nvar round = 0;\nvar target = 2;\nvar startTime = Date.now();\nspeed = 0.3;\nvar passtime = 20\nvar roadx = road.x\nvar roady = road.y\nvar borderx = border.x\nvar bordery = border.y\nvar check1x = check1.x\nvar check2x = check2.x\nvar check2y = check2.y\nvar check1y = check1.y\nvar exit = 0\n\ncar.direction = 0\ncheck1.direction = 180\ncheck2.direction = 180\nroad.direction = 180\nborder.direction = 180\nvar map = createSprite({\n x: 0,\n y: 390,\n scale: 20, // 1.2倍大\n costumes: [\"road.png\"]\n})\nforever(function() {\n car.direction = 0\n //\n if (speed \u003c 1) {\n speed = 1\n }\n passtime = (Date.now()-startTime)/1000;\n print(\"經過時間\"+passtime+\"秒\", 20, 20, \"red\", 20);\n print(Math.floor((speed*10))+\"km/h\", 10, 50, 'red', 30);\n print(\"偏移車道次數\"+ exit+'/3', 10, 90, 'red', 20);\n\n\n touched();\n move();\n speedtouched();\n\n});\nfunction touched() {\n if (key.right) {\n road.direction += 3;\n border.direction += 3;\n check1.direction += 3;\n check2.direction += 3;\n speed -= 0.04\n print(\"正在過彎\", 20, 200, \"red\", 20);\n }\n if (key.left) {\n road.direction -= 3;\n border.direction -= 3;\n check1.direction -= 3;\n check2.direction -= 3;\n speed -= 0.04\n print(\"正在過彎\", 20, 200, \"red\", 20);\n }\n if (key.up) {\n if (speed \u003c 20) {\n speed += 0.08;\n }\n print(\"正在加速\", 20, 250, \"red\", 20);\n } else {\n if (speed \u003c 0) {\n speed = 0\n }\n print(\"已放空油門 \", 20, 350, \"red\", 20);\n speed -= 0.01;\n }\n if (key.down) {\n speed -= 0.1;\n print(\"正在減速 \", 20, 250, \"red\", 20);\n if (speed \u003c 0) {\n speed = 0\n }\n }\n if (key.space) {\n speed = 0;\n print(\"已把速度降至最低\", 20, 300, \"red\", 20);\n }\n if (car.touched(border)) {\n if (exit \u003c 2) {\n\n exit +=1\n border.x = borderx\n border.y = bordery\n road.x = roadx\n road.y = roady\n check1.x = check1x\n check1.y = check1y\n check2.x = check2x\n check2.y = check2y\n speed = 0\n car.direction = 0\n if (key.space) {\n speed = 10;\n print(\"已把速度降至最低\", 20, 300, \"red\", 20);\n //} else {\n //speed = 0.000;\n // print(\"注意!賽車已衝出道路!\", 20, 150, \"red\", 20);\n }\n } else {\n print(\"game over\", 100, 165, \"red\", 100);\n stop();\n }\n }\n}\nfunction move() {\n\n car.direction = border.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}\nfunction speedtouched() {}\n\nif (speed \u003c 1) {\n speed = 1\n}\n\nfunction end() {\n if (target == 1 \u0026\u0026 car.touched(check1)) {\n target = 2;\n round += 1;\n }\n if (car.touched(check1) \u0026\u0026 target == 1) {\n target = 2\n round += 1\n }\n}\n","created_at":"2020-10-23T19:08:59.829+08:00","updated_at":"2021-01-14T20:30:01.410+08:00","name":"急速賽車","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/197238/2d344fa95e650aeb37ff2df8dc9f718d.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":65,"hashid":"wdks4v3p3","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3383779,"file_name":"car.png","project_id":197238,"asset_id":24181,"created_at":"2020-10-23T19:08:59.834+08:00","updated_at":"2020-10-23T19:08:59.834+08:00"},{"id":3383780,"file_name":"border.png","project_id":197238,"asset_id":24182,"created_at":"2020-10-23T19:08:59.835+08:00","updated_at":"2020-10-23T19:08:59.835+08:00"},{"id":3383781,"file_name":"road.png","project_id":197238,"asset_id":24183,"created_at":"2020-10-23T19:08:59.836+08:00","updated_at":"2020-10-23T19:08:59.836+08:00"},{"id":3383782,"file_name":"check.png","project_id":197238,"asset_id":24184,"created_at":"2020-10-23T19:08:59.837+08:00","updated_at":"2020-10-23T19:08:59.837+08:00"},{"id":3425639,"file_name":"backdrop.png","project_id":197238,"asset_id":274805,"created_at":"2020-10-26T15:08:19.124+08:00","updated_at":"2020-10-26T15:08:19.124+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦