{"id":472963,"student_id":2589,"content":"setBackdrop('bg.png'); //設定背景\nlet player = createSprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png', 'p_4.png', 'p_5.png'); //玩家\nlet mom = createSprite('dad_0.png', 'dad_1.png'); //鵝媽媽\nlet dad = createSprite('mom_0.png', 'mom_1.png'); //鵝爸爸\nlet info = createSprite('info.png'); //遊戲說明\n\nlet count = 0; //推車\nlet total = 0; //完成數\nlet clock = 0; //遊戲迴圈執行次數\nlet babies = []; //存放所有小鵝的陣列\n\nplayer.moveTo(1000, 450); //移動到出口\nmom.moveTo(200, 200); //移動左上角\ndad.moveTo(200, 700); //移動左下角\n\ninfo.layer = 1; //避免遊戲說明被蓋住\n\n//設定角色圖片水平翻轉屬性\nplayer.rotationStyle = 'flipped';\nmom.rotationStyle = 'flipped';\ndad.rotationStyle = 'flipped';\n\ncreateSound('bgm.mp3');\n\nfor (let i = 0; i \u003c 30; i++) {\n let baby = createSprite('baby_0.png', 'baby_1.png'); //創造鵝寶寶\n baby.x = Math.random() * 800 + 200; //隨機水平位置\n baby.y = Math.random() * 700 + 100; //隨機垂直位置\n baby.rotationStyle = 'flipped'; //圖片水平翻轉屬性\n babies.push(baby); //角色存入陣列中\n}\n\n// 遊戲主迴圈\nfunction gameloop () {\n if (info.hidden) {\n updatePlayer(); //更新玩家\n updateParents(); //更新鵝爸媽\n for (let i = 0; i \u003c 30; i++) {\n updateBaby(babies[i]); //更新鵝寶寶\n }\n aniamtion(); //走路動畫\n checkIsGameover(); //確認遊戲是否結束\n clock++; //紀錄遊戲迴圈執行次數加一\n }\n if (cursor.isDown) {\n info.hidden = true; //隱藏遊戲說明\n }\n}\n\n// 更新叩叮玩家\nfunction updatePlayer () {\n if (player.touched(cursor) == false) {\n player.toward(cursor);\n player.stepForward(6);\n }\n\n if (player.x \u003e 1000 \u0026\u0026 player.y \u003e 300 \u0026\u0026 player.y \u003c 600 \u0026\u0026 count \u003e 0) {\n total += count;\n count = 0;\n createSound('drop.mp3');\n }\n inBox(player); //限制叩叮在柵欄內\n}\n\n// 更新鵝媽媽與鵝爸爸\nfunction updateParents () {\n mom.toward(player);\n mom.stepForward(2);\n if (clock % 200 == 0) dad.toward(player);\n dad.stepForward(4);\n inBox(dad); //限制鵝爸爸在柵欄內\n}\n\n// 更新鵝寶寶\nfunction updateBaby(baby) {\n baby.toward(mom);\n baby.stepForward(2);\n baby.toward(player);\n baby.stepForward(-2);\n\n for (let i = 0; i \u003c 30; i++) {\n baby.toward(babies[i]);\n baby.stepForward(-0.02);\n }\n\n if (player.touched(baby) \u0026\u0026 count \u003c 10) {\n baby.destroy();\n count += 1;\n createSound('pick.mp3');\n }\n inBox(baby); //限制鵝寶寶在柵欄內\n}\n\n// 走路動畫\nfunction aniamtion () {\n // 遊戲迴圈每執行 20 次就切換一次左右腳的圖\n let id = clock % 20 \u003e 10 ? 0: 1;\n player.costumeId = id;\n mom.costumeId = id;\n dad.costumeId = id;\n // 將鵝寶寶逐一取出並切換動畫\n for (let i = 0; i \u003c babies.length; i++) {\n babies[i].costumeId = id;\n }\n\n if (count \u003e= 1) player.costumeId += 2; //數量超過 1 就在造型 2 和 3 之間切換\n if (count == 10) player.costumeId += 2; //數量達到 10 就在造型 4 和 5 之間切換\n}\n\n// 確認遊戲是否結束\nfunction checkIsGameover () {\n // 如果碰到鵝媽媽或鵝爸爸\n if (player.touched(mom) || player.touched(dad)) {\n createSprite('fail.png'); //顯示失敗圖\n stop(); //停止遊戲\n createSound('fail.mp3'); //播放失敗音效\n }\n\n // 如果時間到了\n if (clock \u003e= 3600) {\n createSprite('timesup.png'); //顯示時間到圖\n stop(); //停止遊戲\n createSound('fail.mp3'); //播放失敗音效\n }\n\n // 如果收集到 30 隻鵝寶寶\n if (total == 30) {\n createSprite('success.png'); //顯示獲勝圖\n stop(); //停止遊戲\n createSound('win.mp3'); //播放獲勝音效\n }\n}\n\n// 限制角色在柵欄內\nfunction inBox (s) {\n if (s.x \u003e 1100) s.x = 1100; //防止超過右邊邊界\n if (s.y \u003e 800) s.y = 800; //防止超過下方邊界\n if (s.x \u003c 100) s.x = 100; //防止超過左邊邊界\n if (s.y \u003c 100) s.y = 100; //防止超過上方邊界\n}\n\nforever(gameloop); //重複不斷執行遊戲迴圈","created_at":"2022-12-12T15:22:10.677+08:00","updated_at":"2022-12-12T15:22:10.677+08:00","name":"叩叮捉小鵝(完整版) 副本","language":"javascript","screenshot":{"url":null},"parent_id":460702,"plugin":"Game.set({\n width: 1200, height: 900\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":47,"hashid":"vngs5gy6y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":10761335,"file_name":"p_2.png","project_id":472963,"asset_id":581779,"created_at":"2022-12-12T15:22:10.687+08:00","updated_at":"2022-12-12T15:22:10.687+08:00"},{"id":10761336,"file_name":"p_1.png","project_id":472963,"asset_id":581780,"created_at":"2022-12-12T15:22:10.689+08:00","updated_at":"2022-12-12T15:22:10.689+08:00"},{"id":10761337,"file_name":"p_0.png","project_id":472963,"asset_id":581781,"created_at":"2022-12-12T15:22:10.690+08:00","updated_at":"2022-12-12T15:22:10.690+08:00"},{"id":10761338,"file_name":"fail.png","project_id":472963,"asset_id":581782,"created_at":"2022-12-12T15:22:10.692+08:00","updated_at":"2022-12-12T15:22:10.692+08:00"},{"id":10761339,"file_name":"bg.png","project_id":472963,"asset_id":581783,"created_at":"2022-12-12T15:22:10.693+08:00","updated_at":"2022-12-12T15:22:10.693+08:00"},{"id":10761340,"file_name":"baby_1.png","project_id":472963,"asset_id":581784,"created_at":"2022-12-12T15:22:10.694+08:00","updated_at":"2022-12-12T15:22:10.694+08:00"},{"id":10761341,"file_name":"baby_0.png","project_id":472963,"asset_id":581785,"created_at":"2022-12-12T15:22:10.696+08:00","updated_at":"2022-12-12T15:22:10.696+08:00"},{"id":10761342,"file_name":"win.mp3","project_id":472963,"asset_id":581786,"created_at":"2022-12-12T15:22:10.697+08:00","updated_at":"2022-12-12T15:22:10.697+08:00"},{"id":10761343,"file_name":"fail.mp3","project_id":472963,"asset_id":581787,"created_at":"2022-12-12T15:22:10.698+08:00","updated_at":"2022-12-12T15:22:10.698+08:00"},{"id":10761344,"file_name":"dad_1.png","project_id":472963,"asset_id":581788,"created_at":"2022-12-12T15:22:10.699+08:00","updated_at":"2022-12-12T15:22:10.699+08:00"},{"id":10761345,"file_name":"mom_1.png","project_id":472963,"asset_id":581789,"created_at":"2022-12-12T15:22:10.700+08:00","updated_at":"2022-12-12T15:22:10.700+08:00"},{"id":10761346,"file_name":"mom_0.png","project_id":472963,"asset_id":581790,"created_at":"2022-12-12T15:22:10.702+08:00","updated_at":"2022-12-12T15:22:10.702+08:00"},{"id":10761347,"file_name":"dad_0.png","project_id":472963,"asset_id":581791,"created_at":"2022-12-12T15:22:10.703+08:00","updated_at":"2022-12-12T15:22:10.703+08:00"},{"id":10761348,"file_name":"pick.mp3","project_id":472963,"asset_id":581792,"created_at":"2022-12-12T15:22:10.704+08:00","updated_at":"2022-12-12T15:22:10.704+08:00"},{"id":10761349,"file_name":"drop.mp3","project_id":472963,"asset_id":581793,"created_at":"2022-12-12T15:22:10.705+08:00","updated_at":"2022-12-12T15:22:10.705+08:00"},{"id":10761350,"file_name":"bgm.mp3","project_id":472963,"asset_id":581794,"created_at":"2022-12-12T15:22:10.706+08:00","updated_at":"2022-12-12T15:22:10.706+08:00"},{"id":10761351,"file_name":"timesup.png","project_id":472963,"asset_id":581795,"created_at":"2022-12-12T15:22:10.708+08:00","updated_at":"2022-12-12T15:22:10.708+08:00"},{"id":10761352,"file_name":"success.png","project_id":472963,"asset_id":581796,"created_at":"2022-12-12T15:22:10.709+08:00","updated_at":"2022-12-12T15:22:10.709+08:00"},{"id":10761353,"file_name":"p_5.png","project_id":472963,"asset_id":581797,"created_at":"2022-12-12T15:22:10.710+08:00","updated_at":"2022-12-12T15:22:10.710+08:00"},{"id":10761354,"file_name":"p_4.png","project_id":472963,"asset_id":581798,"created_at":"2022-12-12T15:22:10.711+08:00","updated_at":"2022-12-12T15:22:10.711+08:00"},{"id":10761355,"file_name":"p_3.png","project_id":472963,"asset_id":581799,"created_at":"2022-12-12T15:22:10.713+08:00","updated_at":"2022-12-12T15:22:10.713+08:00"},{"id":10761356,"file_name":"info.png","project_id":472963,"asset_id":581800,"created_at":"2022-12-12T15:22:10.714+08:00","updated_at":"2022-12-12T15:22:10.714+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦