{"id":117894,"student_id":10,"content":"setBackdrop(\"black\")\n\nvar life = 10;\nvar clock = 0;\nvar power = 100;\nvar missiles = [];\nvar enemies = [];\nvar cloubs = [];\n\nforever(loop);\nwhen('click', fire);\n\n\n\nfunction fire () {\n if (power \u003c 30) return;\n power-= 30;\n \n \n var m = createSprite(['g.png', 'p.png']);\n m.y = 480;\n m.scale = 0.5;\n m.power = m.distanceTo(cursor);\n m.toward(cursor);\n m.costumeId = 0;\n missiles.push(m);\n}\n\nfunction createEnemie () {\n var e = createSprite(['r.png']);\n e.x = Math.random()*640;\n e.y = 0;\n e.scale = 0.5;\n e.speed = 1 + Math.random()*2;\n e.direction = 135 + Math.random()*90;\n enemies.push(e);\n}\n\nfunction createCloubs (x, y) {\n var c = createSprite('w.png');\n c.moveTo(x, y);\n c.scale = 0.7;\n c.layer = -1;\n cloubs.push(c);\n}\n\n\nfunction loop () {\n print('power: ' + power, 10, 10, 'white');\n print('life: ' + life, 10, 40, 'white');\n \n if (power \u003c 100)power++;\n \n clock++;\n if (clock % 60 === 0) {\n createEnemie();\n }\n \n if (clock % 5 === 0) {\n missiles.forEach(function (m) {\n if (!m._deleted) createCloubs(m.x, m.y);\n });\n }\n \n missiles.forEach(function (m) {\n if (m.costumeId == 1) {\n m.scale += 0.3;\n if (m.scale \u003e 3) m.destroy();\n } else if (m.power \u003c 0) {\n m.costumeId = 1;\n m.scale = 1;\n } else {\n m.stepForward(3);\n m.power -= 3;\n }\n });\n \n enemies.forEach(function (e) {\n e.stepForward(e.speed);\n \n if (e.x \u003c 0 || e.x \u003e 640) {\n e.destroy();\n }\n if (e.y \u003e 480 \u0026\u0026 !e._deleted) {\n life--;\n e.destroy();\n }\n });\n \n cloubs.forEach(function (c) {\n c.scale -= 0.01;\n c.opacity -= 0.01;\n if (c.scale \u003c= 0) {\n c.destroy();\n }\n });\n \n \n missiles.forEach(function (m) {\n enemies.forEach(function (e) {\n if (m.touched(e) \u0026\u0026 m.costumeId == 1) {\n e.destroy();\n }\n });\n });\n}","created_at":"2019-12-30T13:36:53.933+08:00","updated_at":"2019-12-30T15:53:48.364+08:00","name":"game","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/117894/29bfa4b1d5b9b27e65c78ddb20e17f18.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":246,"hashid":"p93sy8md","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2021566,"file_name":"b.png","project_id":117894,"asset_id":175834,"created_at":"2019-12-30T13:40:04.177+08:00","updated_at":"2019-12-30T13:40:04.177+08:00"},{"id":2021567,"file_name":"p.png","project_id":117894,"asset_id":175835,"created_at":"2019-12-30T13:40:04.180+08:00","updated_at":"2019-12-30T13:40:04.180+08:00"},{"id":2021568,"file_name":"w.png","project_id":117894,"asset_id":175836,"created_at":"2019-12-30T13:40:04.893+08:00","updated_at":"2019-12-30T13:40:04.893+08:00"},{"id":2021569,"file_name":"r.png","project_id":117894,"asset_id":175837,"created_at":"2019-12-30T13:40:04.895+08:00","updated_at":"2019-12-30T13:40:04.895+08:00"},{"id":2021570,"file_name":"g.png","project_id":117894,"asset_id":175838,"created_at":"2019-12-30T13:40:05.482+08:00","updated_at":"2019-12-30T13:40:05.482+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦