{"id":206721,"student_id":12205,"content":"setBackdrop(\"./assets/background.png\", 0, 0, 520, 390);\r\n\r\nvar bird = createSprite(\"./assets/bird.png\");\r\nvar tubeUp = createSprite({\r\n costumes: \"./assets/up-tube.png\",\r\n x: 400,\r\n \ty: -30\r\n});\r\nvar tubeDown = createSprite({\r\n \tcostumes: \"./assets/down-tube.png\",\r\n\tx: 400,\r\n \ty: 430\r\n});\r\nvar startBtn = createSprite(\"./assets/start-button.png\");\r\nvar gameOverLogo = createSprite({\r\n costumes: \"./assets/gameover.png\",\r\n hidden: true,\r\n y: 100\r\n});\r\n\r\nvar bgm = sound.play('./assets/bgm.ogg');\r\nbgm.loop = true;\r\n\r\nvar vy = 0;\r\nvar scores = 0;\r\nvar flying = false;\r\nforever(function() {\r\n if(!flying) {\r\n return;\r\n }\r\n tubeUp.x -= 2;\r\n tubeDown.x -= 2;\r\n if(tubeUp.x \u003c 0) {\r\n resetTube();\r\n scores += 1;\r\n }\r\n bird.y += vy;\r\n vy += 0.2;\r\n print(scores, 10, 10, 'white', 45);\r\n if(bird.y \u003e 400 || bird.y \u003c 0) {\r\n gameOver();\r\n }\r\n});\r\n\r\nwhen('click', function() { \r\n vy = -5;\r\n sound.play('./assets/jump.ogg');\r\n});\r\nbird.when('touch', [tubeUp, tubeDown], gameOver);\r\nstartBtn.when('click', start);\r\n\r\nfunction resetTube () {\r\n var pos = Math.random()*300 + 50;\r\n tubeUp.x = 450;\r\n tubeDown.x = 450;\r\n tubeUp.y = pos - 230;\r\n tubeDown.y = pos + 230;\r\n}\r\nfunction start () {\r\n \tstartBtn.hidden = true;\r\n gameOverLogo.hidden = true;\r\n bird.y = 200;\r\n scores = 0;\r\n flying = true;\r\n tubeUp.x = 450;\r\n tubeDown.x = 450;\r\n}\r\nfunction gameOver () {\r\n gameOverLogo.hidden = false;\r\n startBtn.hidden = false;\r\n flying = false;\r\n}","created_at":"2020-11-25T17:03:14.885+08:00","updated_at":"2020-11-25T17:03:28.557+08:00","name":"flappy bird","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/206721/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":47,"hashid":"d5msvv6jd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3590512,"file_name":"Gymnopedie_No_1.mp3","project_id":206721,"asset_id":182919,"created_at":"2020-11-25T17:03:14.891+08:00","updated_at":"2020-11-25T17:03:14.891+08:00"},{"id":3590513,"file_name":"koding.png","project_id":206721,"asset_id":182918,"created_at":"2020-11-25T17:03:14.893+08:00","updated_at":"2020-11-25T17:03:14.893+08:00"},{"id":3590514,"file_name":"space_bg.jpg","project_id":206721,"asset_id":182917,"created_at":"2020-11-25T17:03:14.894+08:00","updated_at":"2020-11-25T17:03:14.894+08:00"},{"id":3590515,"file_name":"earth.png","project_id":206721,"asset_id":182916,"created_at":"2020-11-25T17:03:14.895+08:00","updated_at":"2020-11-25T17:03:14.895+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦