{"id":9422,"student_id":7,"content":"setBackdrop(\"bg.jpg\");\nvar topSpike = createSprite({ costumes: [\"topSpike.png\"], y: 35 });\nvar downSpike = createSprite({ costumes: [\"downSpike.png\"], y: 445 });\nvar bird = createSprite({ costume: [\"bird.png\"], x: 320, y: 240, rotationStyle: 'flipped' });\nvar x = 3;\nvar y = -6;\nvar score = 0;\nvar spikeY = [80, 145, 210, 275, 340];\nvar rightSpikes = []\nvar leftSpikes = []\n\nfor(var i = 0; i \u003c spikeY.length; i++) {\n var rightSpike = createSprite({\n x: 455,\n y: spikeY[i],\n hidden: true,\n costumes: \"rightSpike.png\"\n });\n \n rightSpike.forever(function(){\n if(bird.direction%360 == 90) {\n showSpike(this);\n }else {\n this.hidden = true;\n }\n if(this.touched(bird)) stop();\n });\n\n var leftSpike = createSprite({\n x: 185,\n y: spikeY[i],\n hidden: true,\n costumes: \"leftSpike.png\"\n });\n\n leftSpike.forever(function(){\n if(bird.direction%360 == 270) {\n showSpike(this);\n }else {\n this.hidden = true;\n }\n if(this.touched(bird)) stop();\n });\n}\n\nvar game = 1;\ncreateSpike();\n\nwhen(\"click\", function() {\n y = -6;\n});\n\nforever(function() {\n // console.log(spikeY);\n bird.x += x;\n bird.y += y;\n y += 0.3;\n if(bird.x \u003e 440 || bird.x \u003c 200) {\n x *= -1;\n bird.direction += 180;\n score ++;\n createSpike();\n }\n if(score \u003c 10) {\n print(score,300,205,\"#deebef\",60);\n }else{\n print(score,285,205,\"#deebef\",60);\n }\n if(bird.touched(topSpike) || bird.touched(downSpike)) {\n stop();\n }\n \n});\n\nfunction createSpike() {\n if(game == 1) {\n spikeY = [];\n game ++;\n }else {\n spikeY = [80, 145, 210, 275, 340];\n spikeNum = Math.ceil(Math.random()*4);// 拿掉1~4根刺\n for(var i = 0;i \u003c spikeNum; i++) {\n spikeY.splice( Math.floor(Math.random()*spikeY.length), 1);\n } \n }\n \n}\n\nfunction showSpike(s) {\n for(var i = 0;i \u003c spikeY.length;i++) {\n if(s.y == spikeY[i]) {\n s.hidden = false;\n }\n }\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-10T09:05:10.061+08:00","name":"Don't touch the spike","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/9422/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":9361,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":340,"hashid":"yeysvzrd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":206364,"file_name":"0.wav","project_id":9422,"asset_id":9,"created_at":"2017-08-17T18:36:19.326+08:00","updated_at":"2017-08-17T18:36:19.326+08:00"},{"id":206365,"file_name":"1.wav","project_id":9422,"asset_id":10,"created_at":"2017-08-17T18:36:19.328+08:00","updated_at":"2017-08-17T18:36:19.328+08:00"},{"id":206366,"file_name":"bg.jpg","project_id":9422,"asset_id":25073,"created_at":"2017-08-17T18:36:19.330+08:00","updated_at":"2017-08-17T18:36:19.330+08:00"},{"id":206367,"file_name":"bird.png","project_id":9422,"asset_id":25075,"created_at":"2017-08-17T18:36:19.331+08:00","updated_at":"2017-08-17T18:36:19.331+08:00"},{"id":206368,"file_name":"rightSpike.png","project_id":9422,"asset_id":25076,"created_at":"2017-08-17T18:36:19.333+08:00","updated_at":"2017-08-17T18:36:19.333+08:00"},{"id":206369,"file_name":"leftSpike.png","project_id":9422,"asset_id":25077,"created_at":"2017-08-17T18:36:19.334+08:00","updated_at":"2017-08-17T18:36:19.334+08:00"},{"id":206370,"file_name":"downSpike.png","project_id":9422,"asset_id":25087,"created_at":"2017-08-17T18:36:19.336+08:00","updated_at":"2017-08-17T18:36:19.336+08:00"},{"id":206371,"file_name":"topSpike.png","project_id":9422,"asset_id":25088,"created_at":"2017-08-17T18:36:19.337+08:00","updated_at":"2017-08-17T18:36:19.337+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦