{"id":9408,"student_id":7,"content":"setBackdrop(\"bg.jpg\");\n\nvar spike = createSprite(\"spike.png\");\nvar bird = createSprite(\"bird.png\");\nbird.moveTo(320, 240);\nbird.rotationStyle = \"flipped\";\nvar x = 5;\nvar y = -5;\n\nvar spikeY = [80, 145, 210, 275, 340];\nvar leftSpikes = [];\nvar rightSpikes = [];\n\nspike.when(\"touch\", bird, function(){\n stop();\n});\n\n// createSpikes\nfor(var i = 0;i \u003c 5;i++) {\n var rightSpike = createSprite({\n x: 460,\n y: spikeY[i],\n hidden: true,\n costumes: \"rightSpike.png\"\n });\n rightSpike.when(\"touch\", bird, function(){\n stop();\n });\n rightSpikes.push(rightSpike);\n\n var leftSpike = createSprite({\n x: 200,\n y: spikeY[i],\n hidden: true,\n costumes: \"leftSpike.png\"\n });\n leftSpike.when(\"touch\", bird, function(){\n stop();\n });\n leftSpikes.push(leftSpike);\n}\n\nwhen(\"click\", function() {\n y = -5;\n});\n\nforever(function() {\n bird.x += x;\n bird.y += y;\n y += 0.5;\n if(bird.x \u003e 455 || bird.x \u003c 185) {\n x *= -1;\n bird.direction += 180;\n toggleSpike();\n }\n});\n\nfunction toggleSpike() {\n spikeNum = Math.ceil(Math.random()*4) + 1;\n if (bird.direction%360 == 270) {\n for(var i = 0;i \u003c spikeNum; i++) {\n leftSpikes[Math.floor(Math.random()*5)].hidden = false;\n }\n rightSpikes.forEach(function(spike){ spike.hidden = true; })\n } else {\n for(var i = 0;i \u003c spikeNum; i++) {\n rightSpikes[Math.floor(Math.random()*5)].hidden = false;\n }\n leftSpikes.forEach(function(spike){ spike.hidden = true; })\n }\n \n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-10T06:14:32.298+08:00","name":"Don't touch the spike","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/9408/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":9361,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":365,"hashid":"36ysmere","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":206195,"file_name":"0.png","project_id":9408,"asset_id":6,"created_at":"2017-08-17T16:28:51.680+08:00","updated_at":"2017-08-17T16:28:51.680+08:00"},{"id":206196,"file_name":"1.svg","project_id":9408,"asset_id":7,"created_at":"2017-08-17T16:28:51.682+08:00","updated_at":"2017-08-17T16:28:51.682+08:00"},{"id":206197,"file_name":"2.png","project_id":9408,"asset_id":8,"created_at":"2017-08-17T16:28:51.683+08:00","updated_at":"2017-08-17T16:28:51.683+08:00"},{"id":206198,"file_name":"0.wav","project_id":9408,"asset_id":9,"created_at":"2017-08-17T16:28:51.685+08:00","updated_at":"2017-08-17T16:28:51.685+08:00"},{"id":206199,"file_name":"1.wav","project_id":9408,"asset_id":10,"created_at":"2017-08-17T16:28:51.687+08:00","updated_at":"2017-08-17T16:28:51.687+08:00"},{"id":206200,"file_name":"spike.png","project_id":9408,"asset_id":24962,"created_at":"2017-08-17T16:28:51.689+08:00","updated_at":"2017-08-17T16:28:51.689+08:00"},{"id":206201,"file_name":"bg.jpg","project_id":9408,"asset_id":24963,"created_at":"2017-08-17T16:28:51.690+08:00","updated_at":"2017-08-17T16:28:51.690+08:00"},{"id":206202,"file_name":"rightSpike.png","project_id":9408,"asset_id":24965,"created_at":"2017-08-17T16:28:51.692+08:00","updated_at":"2017-08-17T16:28:51.692+08:00"},{"id":206203,"file_name":"leftSpike.png","project_id":9408,"asset_id":24966,"created_at":"2017-08-17T16:28:51.694+08:00","updated_at":"2017-08-17T16:28:51.694+08:00"},{"id":206204,"file_name":"bird.png","project_id":9408,"asset_id":25066,"created_at":"2017-08-17T16:28:51.695+08:00","updated_at":"2017-08-17T16:28:51.695+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦