{"id":169754,"student_id":12205,"content":"var bomb = createSprite(\"bomb.png\");\nvar score = 0;\nvar speed = 1;\nbomb.scale = 0.2;\nbomb.direction = 180;\nbomb.layer = 10;\nbomb.rotationStyle = \"fixed\";\n\nvar boat = createSprite(\"boat.png\");\nboat.x = 320;\nboat.y = 80;\nboat.scale = 0.2; \nboat.layer = 5;\nboat.hp = 200;\n//boat.shot = true;\nfunction creatEnemy(enemyCategory,missileCategory,rate){\n var enemy = createSprite(enemyCategory);\n enemy.x = 20;\n enemy.y = Math.random()*280+180;\n enemy.scale = 0.2;\n enemy.direction = 90;\n enemy.rotationStyle = \"flipped\";\n if (Math.random()*2\u003e1) {\n enemy.direction = 270;\n enemy.x = 680;\n }\n enemy.forever(function(){\n enemy.stepForward(1);\n if (clock%240===0) {\n var missile = createSprite(missileCategory);\n missile.x = enemy.x;\n missile.y = enemy.y;\n missile.scale = 0.1;\n missile.toward(boat);\n missile.forever(function(){\n missile.stepForward(speed+rate);\n if (missile.y\u003c100) {\n missile.destroy();\n }\n if (missile.touched(boat)) {\n missile.destroy();\n boat.hp-=(10*rate);\n }\n });\n }\n if (enemy.x\u003e640\u0026\u0026enemy.direction===90||enemy.x\u003c10\u0026\u0026enemy.direction===270) {\n enemy.destroy(); \n }\n \n });\n enemy.when(\"touch\",bomb, function(){\n enemy.destroy();\n boat.shot = false;\n score = score + (10*rate);\n });\n \n \n \n}\n\n\nforever(function(){\n if (clock%180===0) {\n \n creatEnemy(\"enemy.png\",\"missile.png\",1);\n }\n if (clock%600===0) {\n speed+=2;\n }\n if (clock%1200===0) {\n creatEnemy(\"enemy_boss.png\",\"missile_boss.png\",2);\n }\n if (boat.shot) {\n bomb.stepForward(2);\n if (bomb.y\u003e480) {\n boat.shot = false; \n }\n } \n else {\n bomb.x = boat.x;\n bomb.y = boat.y;\n }\n print(\"score:\"+score,20,20,\"red\");\n print(\"hp:\"+boat.hp,20,40,\"red\");\n});\n\nwhen(\"keydown\",\"space\", function(){\n boat.shot = true;\n});\n\nwhen(\"holding\",\"left\", function(){\n boat.x -=4-( speed/2);\n});\n\nwhen(\"holding\",\"right\", function(){\n boat.x +=4+(speed/2);\n});\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","created_at":"2020-07-23T15:35:34.797+08:00","updated_at":"2020-08-25T11:03:06.034+08:00","name":"深水炸彈 ","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/169754/7fc700d4c0e06b999597eaac7a75f05a.jpg"},"parent_id":113769,"plugin":"setBackdrop(\"#0072E3\");\nvar sky = createSprite(\"天空色.png\");\nsky.x = 320;\nsky.y = 50;\nsky.layer = 1;\nvar clock = 179;\nupdate(function(){\n\tclock++;\n});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":42,"hashid":"qmds6gnm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2932213,"file_name":"missile.png","project_id":169754,"asset_id":27740,"created_at":"2020-07-23T15:35:34.802+08:00","updated_at":"2020-07-23T15:35:34.802+08:00"},{"id":2932214,"file_name":"missile_boss.png","project_id":169754,"asset_id":27739,"created_at":"2020-07-23T15:35:34.804+08:00","updated_at":"2020-07-23T15:35:34.804+08:00"},{"id":2932215,"file_name":"enemy_boss.png","project_id":169754,"asset_id":27738,"created_at":"2020-07-23T15:35:34.805+08:00","updated_at":"2020-07-23T15:35:34.805+08:00"},{"id":2932216,"file_name":"enemy.png","project_id":169754,"asset_id":27737,"created_at":"2020-07-23T15:35:34.806+08:00","updated_at":"2020-07-23T15:35:34.806+08:00"},{"id":2932217,"file_name":"bomb.png","project_id":169754,"asset_id":27736,"created_at":"2020-07-23T15:35:34.807+08:00","updated_at":"2020-07-23T15:35:34.807+08:00"},{"id":2932218,"file_name":"天空色.png","project_id":169754,"asset_id":27735,"created_at":"2020-07-23T15:35:34.808+08:00","updated_at":"2020-07-23T15:35:34.808+08:00"},{"id":2932219,"file_name":"boat.png","project_id":169754,"asset_id":27734,"created_at":"2020-07-23T15:35:34.809+08:00","updated_at":"2020-07-23T15:35:34.809+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦