{"id":78398,"student_id":10,"content":"var player;\nvar balls = [];\nvar score = 0;\nvar clock = 0;\n\nfunction createTarget (x, y) {\n var t = createSprite(['target_3.png','target_4.png','target_5.png']);\n t.moveTo(x, y);\n t.clock = 0;\n t.scale = 0.6;\n t.forever(function () {\n t.clock++;\n \n if (t.clock == 10) {\n t.costumeId = 1;\n }\n if (t.clock == 20) {\n t.costumeId = 2;\n }\n if (t.clock == 30) {\n t.destroy();\n }\n });\n}\n\nfunction fire () {\n var b = createSprite('bullet.png');\n b.moveTo(player);\n b.direction = 0;\n b.forever(function () {\n b.stepForward(8);\n if (b.y \u003c 0) b.destroy();\n });\n \n b.on('touch', balls, function (target) {\n target.life--;\n b.destroy();\n })\n}\n\nfunction createBall () {\n let b = createSprite(['ball_1.png','ball_2.png','ball_3.png']);\n \n\n b.reset = function () {\n b.scale = 1.25;\n b.costumeId = Math.floor(Math.random()*3);\n b.vy = 0;\n b.vx = 0;\n b.life = 3;\n b.freeze = true;\n b.moveTo(Math.random()*640, -35);\n setTimeout(function() { b.freeze = false }, 1000 + Math.random()*3000);\n }\n b.forever(function() {\n if (b.freeze) return;\n b.vy += 0.35;\n b.y += b.vy;\n b.x -= b.vx;\n if (b.y \u003e 400) {\n b.y -= b.vy;\n b.vy = -b.vy;\n if (b.vx == 0) {\n b.vx = Math.random() \u003e 0.5 ? 5: -5;\n b.vy *= 0.85;\n }\n }\n\n if (b.x \u003c 0 || b.x \u003e 640) {\n b.vx *= -1;\n }\n if (b.life \u003c= 0) {\n createTarget(b.x, b.y);\n b.reset();\n score += 30;\n }\n });\n b.reset();\n return b;\n}\n\n\nsetBackdrop(\"bg.png\", 0, 0, 640, 480);\n\nvar startBtn = createSprite(\"start.svg\");\nstartBtn.vd = 2;\nstartBtn.forever(function () {\n if (startBtn.direction \u003e 120) {\n startBtn.vd = -2;\n }\n if (startBtn.direction \u003c 60) {\n startBtn.vd = +2;\n }\n startBtn.direction += startBtn.vd; \n});\nstartBtn.on('click', function (){\n startBtn.destroy();\n \n player = createSprite(\"player.png\");\n player.moveTo(332, 375);\n player.scale = 0.7;\n player.power = 0;\n \n balls = [createBall(), createBall(), createBall()];\n \n forever(function() {\n if ((key.d || key.right) \u0026\u0026 player.x \u003c 640) {\n player.x += 8;\n player.power++;\n }\n if ((key.a || key.left) \u0026\u0026 player.x \u003e 0) {\n player.x -= 8;\n player.power++;\n }\n if (player.power \u003e 6) {\n fire();\n player.power = 0;\n }\n clock++;\n if (clock%60==0) {\n score++;\n }\n print('分數: ' +score, 10, 10, 'red', 30)\n });\n player.on('touch', balls, stop);\n});\n\n\n\n\n\n\n\n\n\n","created_at":"2019-07-11T17:45:13.177+08:00","updated_at":"2019-11-01T15:54:06.882+08:00","name":"擊落星球 副本","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/78398/9a15a816b581fad5187b5b55e7f3dfb6.jpg"},"parent_id":78334,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":297,"hashid":"rdvsgn23","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1345336,"file_name":"ball_3.png","project_id":78398,"asset_id":132969,"created_at":"2019-07-11T17:45:13.182+08:00","updated_at":"2019-07-11T17:45:13.182+08:00"},{"id":1345337,"file_name":"ball_2.png","project_id":78398,"asset_id":132968,"created_at":"2019-07-11T17:45:13.183+08:00","updated_at":"2019-07-11T17:45:13.183+08:00"},{"id":1345338,"file_name":"ball_1.png","project_id":78398,"asset_id":132967,"created_at":"2019-07-11T17:45:13.184+08:00","updated_at":"2019-07-11T17:45:13.184+08:00"},{"id":1345339,"file_name":"bg.png","project_id":78398,"asset_id":88566,"created_at":"2019-07-11T17:45:13.185+08:00","updated_at":"2019-07-11T17:45:13.185+08:00"},{"id":1345340,"file_name":"player.png","project_id":78398,"asset_id":88408,"created_at":"2019-07-11T17:45:13.186+08:00","updated_at":"2019-07-11T17:45:13.186+08:00"},{"id":1345346,"file_name":"bg.wav","project_id":78398,"asset_id":9,"created_at":"2019-07-11T17:45:13.190+08:00","updated_at":"2019-07-11T17:45:13.190+08:00"},{"id":1345347,"file_name":"bullet.png","project_id":78398,"asset_id":88601,"created_at":"2019-07-11T17:45:13.191+08:00","updated_at":"2019-07-11T17:45:13.191+08:00"},{"id":1345349,"file_name":"start.svg","project_id":78398,"asset_id":132950,"created_at":"2019-07-11T17:45:13.193+08:00","updated_at":"2019-07-11T17:45:13.193+08:00"},{"id":1345345,"file_name":"target_1.png","project_id":78398,"asset_id":88570,"created_at":"2019-07-11T17:45:13.190+08:00","updated_at":"2019-07-11T17:45:58.346+08:00"},{"id":1345344,"file_name":"target_2.png","project_id":78398,"asset_id":88397,"created_at":"2019-07-11T17:45:13.189+08:00","updated_at":"2019-07-11T17:46:03.779+08:00"},{"id":1345343,"file_name":"target_3.png","project_id":78398,"asset_id":88396,"created_at":"2019-07-11T17:45:13.188+08:00","updated_at":"2019-07-11T17:46:09.851+08:00"},{"id":1345342,"file_name":"target_4.png","project_id":78398,"asset_id":88394,"created_at":"2019-07-11T17:45:13.187+08:00","updated_at":"2019-07-11T17:46:13.346+08:00"},{"id":1345341,"file_name":"target_5.png","project_id":78398,"asset_id":88395,"created_at":"2019-07-11T17:45:13.186+08:00","updated_at":"2019-07-11T17:46:17.217+08:00"},{"id":1345348,"file_name":"target_6.png","project_id":78398,"asset_id":88389,"created_at":"2019-07-11T17:45:13.192+08:00","updated_at":"2019-07-11T17:46:23.813+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦