{"id":9410,"student_id":10,"content":"setBackdrop(\"bg.jpg\");\n\nvar spike = createSprite(\"spike.png\");\nvar bird = createSprite(\"bird.png\");\nbird.moveTo( 320, 240);\nbird.rotationStyle = \"flipped\";\n\nvar x = 5;\nvar y = -10;\n\nvar spikeY;\nvar spikeNum;\n\nvar score = 0;\n\nvar spikeY = [80, 145, 210, 275, 340];\nfor(var i = 0;i \u003c 5;i++) {\n var rightSpike = createSprite({\n x: 450,\n y: spikeY[i],\n hidden: true,\n costumes: \"rightSpike.png\"\n });\n rightSpike.forever(function(){\n if(bird.direction%360 == 90) {\n showSpike(this);\n }else {\n this.hidden = true;\n }\n if(bird.touched(this)) stop();\n });\n var leftSpike = createSprite({\n x: 190,\n y: spikeY[i],\n hidden: true,\n costumes: \"leftSpike.png\"\n });\n leftSpike.forever(function(){\n if(bird.direction%360 == 270) {\n showSpike(this);\n }else {\n this.hidden = true;\n }\n if(bird.touched(this)) stop();\n });\n}\n\ncreateSpike();\n\nwhen(\"click\", function() {\n y = -10;\n});\n\nforever(function() {\n bird.x += x;\n bird.y += y;\n y += 1;\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 \n if(bird.touched(spike)) {\n stop();\n }\n print(inspector.fps)\n});\n\nfunction createSpike() {\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\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":"2022-11-03T17:38:07.394+08:00","name":"Don't touch the spike","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/9410/daaac7eb2e70aa902704f29e29a6ce38.jpg"},"parent_id":9361,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":455,"hashid":"ej9s2dw9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":206243,"file_name":"0.png","project_id":9410,"asset_id":6,"created_at":"2017-08-17T17:09:46.149+08:00","updated_at":"2017-08-17T17:09:46.149+08:00"},{"id":206244,"file_name":"1.svg","project_id":9410,"asset_id":7,"created_at":"2017-08-17T17:09:46.151+08:00","updated_at":"2017-08-17T17:09:46.151+08:00"},{"id":206245,"file_name":"2.png","project_id":9410,"asset_id":8,"created_at":"2017-08-17T17:09:46.153+08:00","updated_at":"2017-08-17T17:09:46.153+08:00"},{"id":206246,"file_name":"0.wav","project_id":9410,"asset_id":9,"created_at":"2017-08-17T17:09:46.155+08:00","updated_at":"2017-08-17T17:09:46.155+08:00"},{"id":206247,"file_name":"1.wav","project_id":9410,"asset_id":10,"created_at":"2017-08-17T17:09:46.156+08:00","updated_at":"2017-08-17T17:09:46.156+08:00"},{"id":206249,"file_name":"spike.png","project_id":9410,"asset_id":25068,"created_at":"2017-08-17T17:09:46.160+08:00","updated_at":"2017-08-17T17:09:46.160+08:00"},{"id":206250,"file_name":"leftSpike.png","project_id":9410,"asset_id":25071,"created_at":"2017-08-17T17:09:46.161+08:00","updated_at":"2017-08-17T17:09:46.161+08:00"},{"id":206251,"file_name":"rightSpike.png","project_id":9410,"asset_id":25072,"created_at":"2017-08-17T17:09:46.163+08:00","updated_at":"2017-08-17T17:09:46.163+08:00"},{"id":206252,"file_name":"bg.jpg","project_id":9410,"asset_id":25073,"created_at":"2017-08-17T17:09:46.164+08:00","updated_at":"2017-08-17T17:09:46.164+08:00"},{"id":206253,"file_name":"bird.png","project_id":9410,"asset_id":25074,"created_at":"2017-08-17T17:10:24.890+08:00","updated_at":"2017-08-17T17:10:24.890+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦