{"id":12538,"student_id":1407,"content":"var score = 0;\r\nvar speed = 1\r\n\r\nvar bomb = createSprite(\"bomb.png\");\r\nbomb.scale = 0.2;\r\nbomb.layer = 10;\r\nbomb.rotationStyle = \"fixed\";\r\n \r\nvar boat = createSprite(\"boat.png\");\r\nboat.x = 320;\r\nboat.y = 80;\r\nboat.scale = 0.2;\r\nboat.layer = 5;\r\nboat.hp = 200;\r\n\r\nfunction createEnemy(enemyCategory,missileCategory,rate) {\r\n var enemy = createSprite(enemyCategory);\r\n enemy.x = 20;\r\n enemy.y = Math.random()*280+180;\r\n enemy.direction = 90;\r\n enemy.scale = 0.2\r\n enemy.rotationStyle = \"flipped\";\r\n if(Math.random()*2\u003e1) {\r\n enemy.direction = 270;\r\n enemy.x = 680;\r\n }\r\n enemy.forever(function(){\r\n enemy.stepForward(1);\r\n if(clock%240==0) {\r\n var missile = createSprite(missileCategory);\r\n missile.x = enemy.x;\r\n missile.y = enemy.y;\r\n missile.scale = 0.1;\r\n missile.toward(boat);\r\n missile.forever(function(){\r\n missile.stepForward(rate)\r\n if(missile.y\u003c100) {\r\n missile.destroy();\r\n }\r\n if(missile.touched(boat)) {\r\n missile.destroy();\r\n boat.hp-=(10*rate);\r\n }\r\n });\r\n }\r\n if(enemy.x\u003e640 \u0026\u0026 enemy.direction==90 || enemy.x\u003c10\u0026\u0026enemy.direction==270) {\r\n enemy.destroy();\r\n };\r\n enemy.when(\"touch\",bomb,function() {\r\n enemy.destroy();\r\n boat.shot = false;\r\n score+=(10*rate);\r\n });\r\n });\r\n };\r\n\r\n\r\n\r\n\r\n\r\nforever(function(){\r\n if(clock%180 == 0) {\r\n createEnemy(\"enemy.png\",\"missile.png\",1);\r\n }\r\n if(boat.shot) {\r\n bomb.y+=6;\r\n if(bomb.y\u003e480) {\r\n boat.shot = false;\r\n }\r\n }\r\n else{\r\n bomb.x = boat.x;\r\n bomb.y = boat.y;\r\n }\r\n});\r\n\r\nwhen(\"holding\", \"left\", function() {\r\n boat.x-=4\r\n});\r\nwhen(\"holding\", \"right\", function() {\r\n boat.x+=4\r\n});\r\nwhen(\"keydown\", \"space\", function() {\r\n boat.shot = true;\r\n});","created_at":"2017-08-31T21:49:34.717+08:00","updated_at":"2019-11-03T07:34:20.236+08:00","name":"深水炸彈","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/12538/129f5f16699b7f5e7b0db9ed4bceeeb0.jpg"},"parent_id":10357,"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":244,"hashid":"5j3s9569","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":266340,"file_name":"boat.png","project_id":12538,"asset_id":27734,"created_at":"2017-10-01T10:49:07.381+08:00","updated_at":"2017-10-01T10:49:07.381+08:00"},{"id":266341,"file_name":"天空色.png","project_id":12538,"asset_id":27735,"created_at":"2017-10-01T10:49:07.384+08:00","updated_at":"2017-10-01T10:49:07.384+08:00"},{"id":266342,"file_name":"bomb.png","project_id":12538,"asset_id":27736,"created_at":"2017-10-01T10:49:07.387+08:00","updated_at":"2017-10-01T10:49:07.387+08:00"},{"id":266343,"file_name":"enemy.png","project_id":12538,"asset_id":27737,"created_at":"2017-10-01T10:49:07.390+08:00","updated_at":"2017-10-01T10:49:07.390+08:00"},{"id":266344,"file_name":"enemy_boss.png","project_id":12538,"asset_id":27738,"created_at":"2017-10-01T10:49:07.392+08:00","updated_at":"2017-10-01T10:49:07.392+08:00"},{"id":266345,"file_name":"missile_boss.png","project_id":12538,"asset_id":27739,"created_at":"2017-10-01T10:49:07.395+08:00","updated_at":"2017-10-01T10:49:07.395+08:00"},{"id":266346,"file_name":"missile.png","project_id":12538,"asset_id":27740,"created_at":"2017-10-01T10:49:07.397+08:00","updated_at":"2017-10-01T10:49:07.397+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦