{"id":183183,"student_id":2589,"content":"","created_at":"2020-08-20T11:09:00.882+08:00","updated_at":"2020-08-20T11:12:40.118+08:00","name":"flappy bird(學生試玩)","language":"javascript","screenshot":{"url":null},"parent_id":2,"plugin":"Game.set({ width: 1200, height: 900 });\n\nsetBackdrop('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","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":91,"hashid":"4y3s4mpd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3115431,"file_name":"bgm.mp3","project_id":183183,"asset_id":251226,"created_at":"2020-08-20T11:09:40.893+08:00","updated_at":"2020-08-20T11:09:40.893+08:00"},{"id":3115432,"file_name":"jump.mp3","project_id":183183,"asset_id":251227,"created_at":"2020-08-20T11:09:40.900+08:00","updated_at":"2020-08-20T11:09:40.900+08:00"},{"id":3115433,"file_name":"bg.png","project_id":183183,"asset_id":251228,"created_at":"2020-08-20T11:09:40.907+08:00","updated_at":"2020-08-20T11:09:40.907+08:00"},{"id":3115434,"file_name":"bird_1.png","project_id":183183,"asset_id":251229,"created_at":"2020-08-20T11:09:40.911+08:00","updated_at":"2020-08-20T11:09:40.911+08:00"},{"id":3115435,"file_name":"bird_2.png","project_id":183183,"asset_id":251230,"created_at":"2020-08-20T11:09:40.915+08:00","updated_at":"2020-08-20T11:09:40.915+08:00"},{"id":3115436,"file_name":"gameover.png","project_id":183183,"asset_id":251231,"created_at":"2020-08-20T11:09:40.919+08:00","updated_at":"2020-08-20T11:09:40.919+08:00"},{"id":3115437,"file_name":"ground.png","project_id":183183,"asset_id":251232,"created_at":"2020-08-20T11:09:40.923+08:00","updated_at":"2020-08-20T11:09:40.923+08:00"},{"id":3115438,"file_name":"hint.png","project_id":183183,"asset_id":251233,"created_at":"2020-08-20T11:09:40.927+08:00","updated_at":"2020-08-20T11:09:40.927+08:00"},{"id":3115439,"file_name":"pipes.png","project_id":183183,"asset_id":251234,"created_at":"2020-08-20T11:09:40.931+08:00","updated_at":"2020-08-20T11:09:40.931+08:00"},{"id":3115440,"file_name":"gg.mp3","project_id":183183,"asset_id":251235,"created_at":"2020-08-20T11:09:40.935+08:00","updated_at":"2020-08-20T11:09:40.935+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦