{"id":11093,"student_id":10,"content":"setBackdrop(\"bg.jpg\");\nvar paCard = createSprite(\"paCard.png\");\npaCard.moveTo(180,420);\nvar zeroCard = createSprite(\"zeroCard.png\");\nzeroCard.moveTo(260,420);\nvar mushCard = createSprite(\"mushroomCard.png\");\nmushCard.moveTo(340,420);\nvar kodingCard = createSprite(\"kodingCard.png\");\nkodingCard.moveTo(420,420);\nvar fake = createSprite([\"mushroom.png\",\"pa01.png\",\"zero01.png\",\"koding01.png\"]);\nfake.hidden = true;\n\nvar grid = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0]\n]\nvar WIDTH = 60;\nvar HEIGHT = 80;\nvar buliding = false;\nvar countMush = 10000;\nvar enemies = [];\nvar weapons = [];\n\nforever(function(){\n fake.moveTo(cursor);\n print(countMush, 30, 450, 'red', 20);\n});\nsetInterval(createMush, 3000);\nsetInterval(createEnemy, 5000);\n\npaCard.on(\"click\", function(){\n if(countMush \u003e= 80) {\n countMush -= 80;\n fake.costumeId = 1;\n fake.hidden = false;\n }\n});\nzeroCard.on(\"click\", function(){\n if(countMush \u003e= 50) {\n countMush -= 50;\n fake.costumeId = 2;\n fake.hidden = false;\n }\n});\nmushCard.on(\"click\", function(){\n if(countMush \u003e= 20) {\n countMush -= 20;\n fake.costumeId = 0;\n fake.hidden = false;\n }\n});\nkodingCard.on(\"click\", function(){\n if(countMush \u003e= 100) {\n countMush -= 100;\n fake.costumeId = 3;\n fake.hidden = false;\n }\n});\nwhen('click', function () {\n var x = Math.floor(cursor.x/WIDTH);\n var y = Math.floor(cursor.y/HEIGHT);\n if(fake.hidden == false \u0026\u0026 x\u003c9 \u0026\u0026 y\u003c4 \u0026\u0026 grid[y][x] == 0) {\n if(fake.costumeId == 0) {\n var s = createMushroom();\n }\n if(fake.costumeId == 1) {\n var s = createPa();\n }\n if(fake.costumeId == 2) {\n var s = createZero();\n }\n if(fake.costumeId == 3) {\n var s = createKoding();\n }\n s.x = (x + 0.5)*60;\n s.y = (y + 0.5)*80;\n grid[y][x] = 1;\n fake.hidden = true;\n }\n});\n\nfunction createPa () {\n var s = createSprite([\"pa01.png\",\"pa02.png\"]);\n var clock = 0;\n s.forever(function(){\n if(clock%500 == 0) {\n s.costumeId = 1;\n }\n if(clock%600 == 0) {\n s.costumeId = 0;\n clock = 0;\n var weapon = createArrow();\n weapon.moveTo(this);\n }\n clock++;\n });\n return s;\n}\nfunction createZero () {\n var s = createSprite([\"zero01.png\",\"zero02.png\"]);\n var clock = 0;\n s.forever(function(){\n if(clock%500 == 0) {\n s.costumeId = 1;\n }\n if(clock%600 == 0) {\n s.costumeId = 0;\n clock = 0;\n var weapon = createBroom();\n weapon.moveTo(this);\n }\n clock++;\n });\n return s;\n}\nfunction createMushroom () {\n var s = createSprite(\"mushroom.png\");\n var clock = 0;\n s.forever(function(){\n if(clock%600 == 0) {\n var mush = createMush();\n mush.direction = Math.random()*360;\n mush.stepForward(100);\n mush.direction = 90;\n }\n clock++;\n });\n return s;\n}\nfunction createKoding () {\n var s = createSprite([\"koding01.png\",\"koding02.png\"]);\n var clock = 0;\n s.forever(function(){\n if(clock%50 == 0) {\n s.costumeId = 1;\n }\n if(clock%60 == 0) {\n for(var i=0; i\u003cenemies.length; i++) {\n if(this.touched(enemies[i])) {\n enemies[i].life -= 80;\n break;\n }\n }\n s.costumeId = 0;\n clock = 0;\n }\n clock++;\n });\n return s;\n}\nfunction createMush (x, y) {\n var mush = createSprite(\"mushroom(s).png\");\n mush.moveTo(Math.random()*640, 10);\n mush.when('click', function() {\n countMush+=10;\n this.destroy();\n });\n mush.forever(function(){\n this.y += 1;\n });\n return mush;\n}\nfunction createArrow () {\n var s = createSprite(\"pa_arrow.png\");\n s.power = 50;\n s.forever(function(){\n this.x += 1;\n });\n weapons.push(s);\n return s;\n}\nfunction createBroom () {\n var s = createSprite(\"broom.png\");\n s.power = 30;\n s.forever(function(){\n this.direction += 5;\n this.x += 1;\n });\n weapons.push(s);\n return s;\n}\nfunction createEnemy () {\n var s = createSprite([\"kido01.png\",\"kido02.png\",\"witch01.png\",\"witch02.png\"]);\n s.life = 100;\n s.costumeId = Math.floor(Math.random()*3);\n s.moveTo(660,(Math.random()*4 + 0.5)*HEIGHT);\n enemies.push(s);\n s.forever(function(){\n this.x -= 0.1;\n if(this.life \u003c 0) {\n this.destroy();\n }\n });\n s.when('touch', weapons, function (w) {\n this.life -= w.power;\n w.destroy();\n })\n return s;\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-11T15:36:51.277+08:00","name":"Plants Killer","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/11093/aa000e8ca424efb0ef074d1a88535742.jpg"},"parent_id":10375,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":494,"hashid":"jzmsez9r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":243072,"file_name":"bunker.png","project_id":11093,"asset_id":28185,"created_at":"2017-09-10T19:02:34.897+08:00","updated_at":"2017-09-10T19:02:34.897+08:00"},{"id":243073,"file_name":"mushroom.png","project_id":11093,"asset_id":28186,"created_at":"2017-09-10T19:02:34.900+08:00","updated_at":"2017-09-10T19:02:34.900+08:00"},{"id":243074,"file_name":"mushroom(s).png","project_id":11093,"asset_id":28187,"created_at":"2017-09-10T19:02:34.902+08:00","updated_at":"2017-09-10T19:02:34.902+08:00"},{"id":243076,"file_name":"shovel.png","project_id":11093,"asset_id":28229,"created_at":"2017-09-10T19:02:34.907+08:00","updated_at":"2017-09-10T19:02:34.907+08:00"},{"id":243077,"file_name":"koding01.png","project_id":11093,"asset_id":28267,"created_at":"2017-09-10T19:02:34.909+08:00","updated_at":"2017-09-10T19:02:34.909+08:00"},{"id":243078,"file_name":"koding02.png","project_id":11093,"asset_id":28268,"created_at":"2017-09-10T19:02:34.911+08:00","updated_at":"2017-09-10T19:02:34.911+08:00"},{"id":243079,"file_name":"paCard.png","project_id":11093,"asset_id":28711,"created_at":"2017-09-10T19:02:34.914+08:00","updated_at":"2017-09-10T19:02:34.914+08:00"},{"id":243080,"file_name":"kodingCard.png","project_id":11093,"asset_id":28715,"created_at":"2017-09-10T19:02:34.916+08:00","updated_at":"2017-09-10T19:02:34.916+08:00"},{"id":243081,"file_name":"mushroomCard.png","project_id":11093,"asset_id":28716,"created_at":"2017-09-10T19:02:34.918+08:00","updated_at":"2017-09-10T19:02:34.918+08:00"},{"id":243082,"file_name":"zeroCard.png","project_id":11093,"asset_id":28717,"created_at":"2017-09-10T19:02:34.921+08:00","updated_at":"2017-09-10T19:02:34.921+08:00"},{"id":243083,"file_name":"pa_arrow.png","project_id":11093,"asset_id":28825,"created_at":"2017-09-10T19:02:34.923+08:00","updated_at":"2017-09-10T19:02:34.923+08:00"},{"id":243084,"file_name":"zero01.png","project_id":11093,"asset_id":28940,"created_at":"2017-09-10T19:02:34.925+08:00","updated_at":"2017-09-10T19:02:34.925+08:00"},{"id":243085,"file_name":"zero02.png","project_id":11093,"asset_id":28941,"created_at":"2017-09-10T19:02:34.927+08:00","updated_at":"2017-09-10T19:02:34.927+08:00"},{"id":243086,"file_name":"pa01.png","project_id":11093,"asset_id":28943,"created_at":"2017-09-10T19:02:34.930+08:00","updated_at":"2017-09-10T19:02:34.930+08:00"},{"id":243087,"file_name":"pa02.png","project_id":11093,"asset_id":28944,"created_at":"2017-09-10T19:02:34.932+08:00","updated_at":"2017-09-10T19:02:34.932+08:00"},{"id":243088,"file_name":"kido01.png","project_id":11093,"asset_id":28945,"created_at":"2017-09-10T19:02:34.934+08:00","updated_at":"2017-09-10T19:02:34.934+08:00"},{"id":243089,"file_name":"kido02.png","project_id":11093,"asset_id":28946,"created_at":"2017-09-10T19:02:34.936+08:00","updated_at":"2017-09-10T19:02:34.936+08:00"},{"id":243090,"file_name":"witch01.png","project_id":11093,"asset_id":28947,"created_at":"2017-09-10T19:02:34.939+08:00","updated_at":"2017-09-10T19:02:34.939+08:00"},{"id":243091,"file_name":"witch02.png","project_id":11093,"asset_id":28948,"created_at":"2017-09-10T19:02:34.941+08:00","updated_at":"2017-09-10T19:02:34.941+08:00"},{"id":243092,"file_name":"broom.png","project_id":11093,"asset_id":29096,"created_at":"2017-09-10T19:02:34.943+08:00","updated_at":"2017-09-10T19:02:34.943+08:00"},{"id":243131,"file_name":"bg.jpg","project_id":11093,"asset_id":29292,"created_at":"2017-09-10T22:06:29.360+08:00","updated_at":"2017-09-10T22:06:29.360+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦