{"id":169747,"student_id":12205,"content":"setBackdrop(\"black\");\r\nvar obstacle = createSprite([\"level_1.png\", \"level_2.png\", \"level_3.png\", \"level4.png\", \"level_5.png\", \"level_6.png\", \"level_7.png\", \"level_8.png\", \"level_9.png\"]);\r\nvar target = createSprite(\"target.png\");\r\n\r\nvar astronaut = createSprite(\"astronaut.png\");\r\nastronaut.moveTo(40, 40);\r\nvar flames = [];\r\nvar vx = 0;\r\nvar vy = 0;\r\n\r\nforever(function () {\r\n target.direction += 2;\r\n\r\n print('Level' + level, 10, 10, 'red', 20);\r\n\r\n if (key.up || key.left || key.right) {\r\n var flame = createSprite(\"flame.png\");\r\n flame.moveTo(astronaut);\r\n flame.direction = astronaut.direction + 90;\r\n flame.stepForward(30);\r\n flame.direction += Math.random() * 60 - 30;\r\n flame.life = Math.random() * 60;\r\n flames.push(flame);\r\n }\r\n\r\n for (var i = 0; i \u003c flames.length; i++) {\r\n var f = flames[i];\r\n f.stepForward(2.5);\r\n f.life--;\r\n if (f.life \u003e 0) {\r\n f.scale = f.life / 60;\r\n f.opacity = f.life / 60;\r\n } else {\r\n f.destroy();\r\n flames.splice(i, 1);\r\n }\r\n }\r\n\r\n vy += 0.03;\r\n\r\n if (key.up) {\r\n vy -= 0.08;\r\n }\r\n if (key.left) {\r\n vx -= 0.05;\r\n }\r\n if (key.right) {\r\n vx += 0.05;\r\n }\r\n\r\n astronaut.direction = 90 + vx * 10;\r\n astronaut.move(vx, vy);\r\n\r\n if (astronaut.touched(obstacle) || astronaut.x \u003c 0 || astronaut.x \u003e 640 || astronaut.y \u003c 0 || astronaut.y \u003e 480) {\r\n print('GAME OVER!', 100, 100, 'red', 70);\r\n stop();\r\n }\r\n\r\n if (astronaut.touched(target)) {\r\n nextLevel();\r\n }\r\n\r\n});\r\n\r\nvar levels = [\r\n { x: 500, y: 400 },\r\n { x: 500, y: 100 },\r\n { x: 100, y: 450 },\r\n { x: 50, y: 75 },\r\n { x: 500, y: 100 },\r\n { x: 550, y: 400 },\r\n { x: 550, y: 50 },\r\n { x: 375, y: 100 },\r\n { x: 575, y: 365 }\r\n];\r\nvar level = 8;\r\n\r\nfunction nextLevel() {\r\n if (level == 9) {\r\n print('YOU WIN!',150,100,'gold',70);\r\n stop();\r\n }\r\n\r\n target.moveTo(levels[level]);\r\n obstacle.costumeId = level;\r\n level++;\r\n}\r\nnextLevel();\r\n\r\nsetBackdrop(\"black\");\r\n\r\nvar lights = [];\r\nfor(var i = 0;i\u003c15;i++) {\r\n var light = {\r\n x:cursor.x,\r\n y:cursor.y,\r\n color:\"rgb(\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\")\",\r\n vx:Math.random() *8 - 4,\r\n vy:Math.random() *8 - 4,\r\n r:Math.random() * 6\r\n };\r\n lights.push(light);\r\n};\r\n\r\nforever(function(){\r\n for(var i=0;i\u003clights.length;i++) {\r\n var light = lights[i];\r\n light.x +=light.vx;\r\n light.y +=light.vy;\r\n light.vy +=0.1\r\n light.r *=0.99\r\n pen.size = 0;\r\n pen.fillColor = light.color;\r\n if(light.r\u003e1) {\r\n pen.drawCircle(light.x,light.y,light.r);\r\n };\r\n }\r\n for(var i = 0;i\u003c15;i++) {\r\n var light = {\r\n x:cursor.x,\r\n y:cursor.y,\r\n color:\"rgb(\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\")\",\r\n vx:Math.random() *8 - 4,\r\n vy:Math.random() *8 - 4,\r\n r:Math.random() * 6\r\n };\r\n lights.push(light);\r\n };\r\n \r\n});","created_at":"2020-07-23T15:11:12.559+08:00","updated_at":"2020-11-28T15:13:57.886+08:00","name":"太空人探險- More to explore 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/169747/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":16062,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":52,"hashid":"gk4sejz8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2932105,"file_name":"flame.png","project_id":169747,"asset_id":38808,"created_at":"2020-07-23T15:11:12.565+08:00","updated_at":"2020-07-23T15:11:12.565+08:00"},{"id":2932106,"file_name":"circle.png","project_id":169747,"asset_id":38809,"created_at":"2020-07-23T15:11:12.567+08:00","updated_at":"2020-07-23T15:11:12.567+08:00"},{"id":2932107,"file_name":"level_7.png","project_id":169747,"asset_id":38810,"created_at":"2020-07-23T15:11:12.568+08:00","updated_at":"2020-07-23T15:11:12.568+08:00"},{"id":2932108,"file_name":"level_1.png","project_id":169747,"asset_id":38811,"created_at":"2020-07-23T15:11:12.569+08:00","updated_at":"2020-07-23T15:11:12.569+08:00"},{"id":2932109,"file_name":"level_2.png","project_id":169747,"asset_id":38812,"created_at":"2020-07-23T15:11:12.570+08:00","updated_at":"2020-07-23T15:11:12.570+08:00"},{"id":2932110,"file_name":"level_3.png","project_id":169747,"asset_id":38813,"created_at":"2020-07-23T15:11:12.571+08:00","updated_at":"2020-07-23T15:11:12.571+08:00"},{"id":2932111,"file_name":"level_4.png","project_id":169747,"asset_id":38814,"created_at":"2020-07-23T15:11:12.571+08:00","updated_at":"2020-07-23T15:11:12.571+08:00"},{"id":2932112,"file_name":"level_5.png","project_id":169747,"asset_id":38815,"created_at":"2020-07-23T15:11:12.572+08:00","updated_at":"2020-07-23T15:11:12.572+08:00"},{"id":2932113,"file_name":"level_6.png","project_id":169747,"asset_id":38816,"created_at":"2020-07-23T15:11:12.573+08:00","updated_at":"2020-07-23T15:11:12.573+08:00"},{"id":2932114,"file_name":"level_8.png","project_id":169747,"asset_id":38817,"created_at":"2020-07-23T15:11:12.574+08:00","updated_at":"2020-07-23T15:11:12.574+08:00"},{"id":2932115,"file_name":"level_9.png","project_id":169747,"asset_id":38818,"created_at":"2020-07-23T15:11:12.575+08:00","updated_at":"2020-07-23T15:11:12.575+08:00"},{"id":2932116,"file_name":"astronaut.png","project_id":169747,"asset_id":38819,"created_at":"2020-07-23T15:11:12.576+08:00","updated_at":"2020-07-23T15:11:12.576+08:00"},{"id":2932117,"file_name":"target.png","project_id":169747,"asset_id":38820,"created_at":"2020-07-23T15:11:12.577+08:00","updated_at":"2020-07-23T15:11:12.577+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦