{"id":7907,"student_id":1472,"content":"/*!\n * 繞行火星 v.2.0\n */\nsetBackdrop('mars-background.jpg');\nvar bgm = sound.play('bgm.mp3');\nbgm.loop = true;\nvar startplatform = createSprite({\n x: 80,\n y: 250,\n costumes: \"platform.png\"\n});\nvar platform = createSprite(\"platform.png\");\nvar koding = createSprite([\"koding-r.png\", \"bomb.png\"]);\nvar fire = createSprite({\n scale: 0.7,\n costumes: \"fire.png\"\n});\nvar vx = 0;\nvar vy = 0;\nvar fuel = 200;\nvar platformcount = 0;\nvar startfly = false;\nvar gameover = false;\nplatform.x = 500;\nplatform.y = 450;\nkoding.y = 50;\nkoding.x = 50;\nforever(function () {\n fire.x = koding.x;\n fire.y = koding.y;\n if ((key.up || key.left || key.right) \u0026\u0026 fuel \u003e 0) {\n fire.hidden = false;\n } else {\n fire.hidden = true;\n }\n if (koding.y \u003e 480) {\n gameover = true;\n }\n if (koding.touched(startplatform)) {\n koding.y = startplatform.y - 50;\n if (vy \u003e 5 || vx \u003e 5 || vx \u003c -5) {\n gameover = true;\n } else {\n fuel = 200;\n if (startfly == false) {\n vy = 0;\n } else {\n vy -= 0.6;\n }\n }\n }\n if (koding.touched(platform)) {\n koding.y = platform.y - 50;\n if (vy \u003e 2 || vx \u003e 2 || vx \u003c -2) {\n gameover = true;\n } else {\n platformcount++;\n startplatform.y = platform.y;\n platform.y = 50 + Math.random() * 430;\n koding.y = startplatform.y;\n koding.x = startplatform.x + 15;\n fuel = 200;\n vx = 0;\n vy = 0;\n //setBackdrop(\"mars-background2.png\", 0, 0, 640, 480);\n }\n if (startfly == false) {\n vy = 0;\n } else {\n vy -= 0.6;\n }\n }\n if (gameover) {\n fire.hidden = true;\n koding.costumeId = 1;\n print(\"Game Over!\", 75, 240, \"white\", 90);\n stop();\n }\n if (fuel \u003e 0) {\n if (key.left \u0026\u0026 key.right) {\n vy -= 0.1;\n fuel -= 1;\n startfly = true;\n fire.direction = koding.direction + 180;\n fire.stepForward(50);\n fire.direction = koding.direction;\n } else if (key.left) {\n vy -= 0.1;\n vx += 0.1;\n fuel -= 1;\n fire.direction = koding.direction - 90;\n fire.stepForward(30);\n fire.direction = koding.direction + 90;\n } else if (key.right) {\n vy -= 0.1;\n vx -= 0.1;\n fuel -= 1;\n fire.direction = koding.direction + 90;\n fire.stepForward(40);\n fire.direction = koding.direction + 270;\n } else {\n startfly = false;\n }\n }\n vy += 0.06;\n koding.y += vy;\n koding.x += vx;\n koding.direction = vx * 20;\n print('Fuel: ' + fuel, 10, 10, 'white', 20);\n print('Platform Touched: ' + platformcount, 10, 35, 'white', 20);\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-11T20:54:08.762+08:00","name":"繞行火星","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/7907/6868da58cbe5fe86c16b030072326b58.jpg"},"parent_id":2,"plugin":"console.log(\"繞行火星\");\nconsole.log(\"v.2.0\");","description":"","note":"","status":"public","like_student_ids":[1472,180],"is_featured":false,"views":483,"hashid":"yeys983","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":174802,"file_name":"bomb.png","project_id":7907,"asset_id":19412,"created_at":"2017-07-14T12:29:27.281+08:00","updated_at":"2017-07-14T12:29:27.281+08:00"},{"id":174803,"file_name":"fire.png","project_id":7907,"asset_id":19414,"created_at":"2017-07-14T12:29:27.285+08:00","updated_at":"2017-07-14T12:29:27.285+08:00"},{"id":174804,"file_name":"mars-background.jpg","project_id":7907,"asset_id":21246,"created_at":"2017-07-14T12:29:29.044+08:00","updated_at":"2017-07-14T12:29:29.044+08:00"},{"id":174805,"file_name":"platform.png","project_id":7907,"asset_id":19415,"created_at":"2017-07-14T12:29:29.045+08:00","updated_at":"2017-07-14T12:29:29.045+08:00"},{"id":174806,"file_name":"rocket.png","project_id":7907,"asset_id":19413,"created_at":"2017-07-14T12:29:29.790+08:00","updated_at":"2017-07-14T12:29:29.790+08:00"},{"id":174808,"file_name":"koding-r.png","project_id":7907,"asset_id":21247,"created_at":"2017-07-14T12:44:38.258+08:00","updated_at":"2017-07-14T12:44:38.258+08:00"},{"id":174809,"file_name":"platform1.png","project_id":7907,"asset_id":21248,"created_at":"2017-07-14T14:30:49.126+08:00","updated_at":"2017-07-14T14:30:49.126+08:00"},{"id":174810,"file_name":"platform2.png","project_id":7907,"asset_id":21249,"created_at":"2017-07-14T14:30:49.132+08:00","updated_at":"2017-07-14T14:30:49.132+08:00"},{"id":174811,"file_name":"platform3.png","project_id":7907,"asset_id":21250,"created_at":"2017-07-14T14:30:49.697+08:00","updated_at":"2017-07-14T14:30:49.697+08:00"},{"id":174812,"file_name":"platform4.png","project_id":7907,"asset_id":21251,"created_at":"2017-07-14T14:30:49.701+08:00","updated_at":"2017-07-14T14:30:49.701+08:00"},{"id":174813,"file_name":"platform5.png","project_id":7907,"asset_id":21252,"created_at":"2017-07-14T14:30:50.152+08:00","updated_at":"2017-07-14T14:30:50.152+08:00"},{"id":174817,"file_name":"mars-background2.png","project_id":7907,"asset_id":21256,"created_at":"2017-07-14T16:32:38.353+08:00","updated_at":"2017-07-14T16:32:38.353+08:00"},{"id":174820,"file_name":"bgm.mp3","project_id":7907,"asset_id":21258,"created_at":"2017-07-14T16:51:22.164+08:00","updated_at":"2017-07-14T16:51:22.164+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦