{"id":138884,"student_id":1404,"content":"setBackdrop('bg.png');\nvar p1 = createSprite('pipes.png'); //1號水管\nvar p2 = createSprite('pipes.png'); //2號水管\nvar p3 = createSprite('pipes.png'); //3號水管\nvar gd = createSprite('ground.png'); //地板\nvar bird = createSprite('bird_1.png', 'bird_2.png'); //鳥\nvar hint = createSprite('hint.png'); //開始提示圖\nvar end = createSprite('gameover.png'); //結束提示圖\n\nvar speed = 0; //鳥的墜落速度\nvar score = 0; //遊戲分數\nvar start = false; //是否開始遊戲\n\n// hint.hidden = true; //隱藏開始提示圖\nend.hidden = true; //隱藏結束提示圖\n\nforever(loop); // 不斷執行遊戲迴圈\non('keydown', jump); //按下任意按鍵使鳥跳躍\nbird.on('touch', [p1, p2, p3, gd], gameover); //當鳥碰撞到障礙物時結束遊戲\n\np1.x = 0;\np2.x = 500;\np3.x = 1000;\n\n// 遊戲主迴圈\nfunction loop () {\n moveGround(); //移動地板\n movePipe(p1); //移動1號水管\n movePipe(p2); //移動2號水管\n movePipe(p3); //移動2號水管\n moveBird(); //移動鳥\n}\n\n//移動地板\nfunction moveGround () {\n gd.x = gd.x - 6;\n if (gd.x \u003c 0) {\n gd.x = gd.x + 1200;\n }\n}\n\n//移動水管\nfunction movePipe (pipe) {\n pipe.x = pipe.x - 6;\n if (pipe.x \u003c -100) {\n pipe.x = pipe.x + 1500;\n if (start == true) {\n pipe.y = Math.random()*500 + 150;\n score = score + 1;\n }\n }\n drawText(score, 10, 10, 'white', 60);\n}\n\n//鳥的墜落 \u0026 翅膀動畫\nfunction moveBird () {\n if (start == true) {\n speed = speed + 0.8;\n bird.y = bird.y + speed;\n }\n if (speed \u003e 0) {\n bird.costumeId = 0;\n }\n if (speed \u003c 0) {\n bird.costumeId = 1;\n }\n}\n\n//鳥的跳躍\nfunction jump () {\n speed = -12;\n start = true;\n sound.play('jump.mp3');\n hint.hidden = true;\n}\n\n//遊戲結束\nfunction gameover () {\n stop();\n sound.play('gg.mp3');\n end.hidden = false;\n}\n\nsound.play('bgm.mp3', true); //播放背景音樂\n","created_at":"2020-04-11T02:14:28.925+08:00","updated_at":"2020-04-13T23:56:17.375+08:00","name":"flappy bird(完整版)","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/138884/7006bcf72b9e9aba093cdf2546144ed1.jpg"},"parent_id":2,"plugin":"Game.set({ width: 1200, height: 900 });","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":115,"hashid":"zpespm9e","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2394452,"file_name":"bgm.mp3","project_id":138884,"asset_id":204184,"created_at":"2020-04-11T02:15:01.055+08:00","updated_at":"2020-04-11T02:15:01.055+08:00"},{"id":2394453,"file_name":"jump.mp3","project_id":138884,"asset_id":204185,"created_at":"2020-04-11T02:15:01.060+08:00","updated_at":"2020-04-11T02:15:01.060+08:00"},{"id":2394454,"file_name":"bg.png","project_id":138884,"asset_id":204186,"created_at":"2020-04-11T02:15:01.064+08:00","updated_at":"2020-04-11T02:15:01.064+08:00"},{"id":2394455,"file_name":"bird_1.png","project_id":138884,"asset_id":204187,"created_at":"2020-04-11T02:15:01.068+08:00","updated_at":"2020-04-11T02:15:01.068+08:00"},{"id":2394456,"file_name":"bird_2.png","project_id":138884,"asset_id":204188,"created_at":"2020-04-11T02:15:01.071+08:00","updated_at":"2020-04-11T02:15:01.071+08:00"},{"id":2394457,"file_name":"gameover.png","project_id":138884,"asset_id":204189,"created_at":"2020-04-11T02:15:01.081+08:00","updated_at":"2020-04-11T02:15:01.081+08:00"},{"id":2394458,"file_name":"ground.png","project_id":138884,"asset_id":204190,"created_at":"2020-04-11T02:15:01.084+08:00","updated_at":"2020-04-11T02:15:01.084+08:00"},{"id":2394459,"file_name":"hint.png","project_id":138884,"asset_id":204191,"created_at":"2020-04-11T02:15:01.088+08:00","updated_at":"2020-04-11T02:15:01.088+08:00"},{"id":2394460,"file_name":"pipes.png","project_id":138884,"asset_id":204192,"created_at":"2020-04-11T02:15:01.092+08:00","updated_at":"2020-04-11T02:15:01.092+08:00"},{"id":2394461,"file_name":"gg.mp3","project_id":138884,"asset_id":204193,"created_at":"2020-04-11T02:15:01.096+08:00","updated_at":"2020-04-11T02:15:01.096+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦