{"id":188177,"student_id":3760,"content":"setBackdrop('#000000');\nlet ship = createSprite(\"ship.png\");\nlet clock = 0;\nlet bullets = [];\nlet score = 0;\nlet energy = createSprite(\"food.png\");\nlet alive = true;\nenergy.x = Math.random()*640;\nenergy.y = Math.random()*480;\n\n\nforever(function () {\n createEnergy();\n shipControl();\n createBullet();\n bulletMove();\n print(score, 20, 20, \"white\", 20);\n if (!alive) {\n print(\"Game Over\", 160, 240, \"blue\", 60);\n stop();\n }\n});\n\n\n\nfunction shipControl() {\n ship.toward(cursor);\n if (!ship.touched(cursor))\n \n ship.stepForward(3);\n}\n\nfunction createBullet() {\n clock += 1;\n if (clock%10===0) {\n let bullet = createSprite(\"bullet.png\");\n bullet.direction = Math.random()*360;\n bullet.stepForward(500);\n bullet.direction = Math.random()*360;\n bullets.push(bullet);\n }\n}\n\nfunction bulletMove() {\n if (clock%2===0) {\n for (let i=0; i\u003cbullets.length; i++) {\n bullets[i].stepForward(2);\n if (bullets[i].touched(ship)) {\n alive = false;\n }\n }\n }\n}\n\nfunction createEnergy() {\n if (ship.touched(energy)) {\n energy.x = Math.random()*640;\n energy.y = Math.random()*480;\n score += 1;\n }\n}","created_at":"2020-09-05T02:33:53.792+08:00","updated_at":"2021-07-28T22:39:20.287+08:00","name":"太空訓練 副本","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/188177/460b95a6e6d196e6bc6ac5c1577d0559.jpg"},"parent_id":10707,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":90,"hashid":"5j3sgrwy","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3199031,"file_name":"bullet.png","project_id":188177,"asset_id":28733,"created_at":"2020-09-05T02:33:53.797+08:00","updated_at":"2020-09-05T02:33:53.797+08:00"},{"id":3199032,"file_name":"food.png","project_id":188177,"asset_id":28734,"created_at":"2020-09-05T02:33:53.798+08:00","updated_at":"2020-09-05T02:33:53.798+08:00"},{"id":3199033,"file_name":"ship.png","project_id":188177,"asset_id":28735,"created_at":"2020-09-05T02:33:53.799+08:00","updated_at":"2020-09-05T02:33:53.799+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦