{"id":194424,"student_id":12205,"content":"\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.3;\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":"2020-10-05T15:22:28.183+08:00","updated_at":"2020-10-20T11:52:37.762+08:00","name":"擊落星球 副本","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/194424/868761fb143dace23ddbb3e4ce91f9c0.jpg"},"parent_id":78334,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":32,"hashid":"6rpsmmpe","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3329348,"file_name":"ball_3.png","project_id":194424,"asset_id":133011,"created_at":"2020-10-05T15:22:28.189+08:00","updated_at":"2020-10-05T15:22:28.189+08:00"},{"id":3329349,"file_name":"ball_2.png","project_id":194424,"asset_id":133010,"created_at":"2020-10-05T15:22:28.192+08:00","updated_at":"2020-10-05T15:22:28.192+08:00"},{"id":3329350,"file_name":"ball_1.png","project_id":194424,"asset_id":133009,"created_at":"2020-10-05T15:22:28.193+08:00","updated_at":"2020-10-05T15:22:28.193+08:00"},{"id":3329351,"file_name":"bg.png","project_id":194424,"asset_id":133008,"created_at":"2020-10-05T15:22:28.194+08:00","updated_at":"2020-10-05T15:22:28.194+08:00"},{"id":3329352,"file_name":"player.png","project_id":194424,"asset_id":133007,"created_at":"2020-10-05T15:22:28.195+08:00","updated_at":"2020-10-05T15:22:28.195+08:00"},{"id":3329353,"file_name":"target_5.png","project_id":194424,"asset_id":133006,"created_at":"2020-10-05T15:22:28.196+08:00","updated_at":"2020-10-05T15:22:28.196+08:00"},{"id":3329354,"file_name":"target_4.png","project_id":194424,"asset_id":133005,"created_at":"2020-10-05T15:22:28.197+08:00","updated_at":"2020-10-05T15:22:28.197+08:00"},{"id":3329355,"file_name":"target_3.png","project_id":194424,"asset_id":133004,"created_at":"2020-10-05T15:22:28.197+08:00","updated_at":"2020-10-05T15:22:28.197+08:00"},{"id":3329356,"file_name":"target_2.png","project_id":194424,"asset_id":133003,"created_at":"2020-10-05T15:22:28.198+08:00","updated_at":"2020-10-05T15:22:28.198+08:00"},{"id":3329357,"file_name":"target_1.png","project_id":194424,"asset_id":133002,"created_at":"2020-10-05T15:22:28.199+08:00","updated_at":"2020-10-05T15:22:28.199+08:00"},{"id":3329358,"file_name":"bg.wav","project_id":194424,"asset_id":133001,"created_at":"2020-10-05T15:22:28.200+08:00","updated_at":"2020-10-05T15:22:28.200+08:00"},{"id":3329359,"file_name":"bullet.png","project_id":194424,"asset_id":133000,"created_at":"2020-10-05T15:22:28.201+08:00","updated_at":"2020-10-05T15:22:28.201+08:00"},{"id":3329360,"file_name":"target_6.png","project_id":194424,"asset_id":132999,"created_at":"2020-10-05T15:22:28.202+08:00","updated_at":"2020-10-05T15:22:28.202+08:00"},{"id":3329361,"file_name":"start.svg","project_id":194424,"asset_id":132998,"created_at":"2020-10-05T15:22:28.203+08:00","updated_at":"2020-10-05T15:22:28.203+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦