{"id":524379,"student_id":1444,"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 animation(); //走路動畫\n checkIsGameover(); //確認遊戲是否結束\n clock++; //紀錄遊戲迴圈執行次數加一\n }\n if (cursor.isDown) {\n info.hidden = true; //隱藏遊戲說明\n }\n}\n\n// 更新叩叮玩家\nfunction updatePlayer () {\n player.toward(cursor);\n player.stepForward(6);\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 dad.toward(player);\n dad.stepForward(2);\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 animation () {\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":"2023-04-28T19:25:02.914+08:00","updated_at":"2023-04-28T22:07:10.605+08:00","name":"叩叮捉小鵝(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/524379/83fdf5f11018da2d695d90caebf4d8db.jpg"},"parent_id":460703,"plugin":"Game.set({\n width: 1200, height: 900\n})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":42,"hashid":"gk4sp39kq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":11943038,"file_name":"p_2.png","project_id":524379,"asset_id":581803,"created_at":"2023-04-28T19:25:02.919+08:00","updated_at":"2023-04-28T19:25:02.919+08:00"},{"id":11943039,"file_name":"p_1.png","project_id":524379,"asset_id":581804,"created_at":"2023-04-28T19:25:02.920+08:00","updated_at":"2023-04-28T19:25:02.920+08:00"},{"id":11943040,"file_name":"p_0.png","project_id":524379,"asset_id":581805,"created_at":"2023-04-28T19:25:02.921+08:00","updated_at":"2023-04-28T19:25:02.921+08:00"},{"id":11943041,"file_name":"fail.png","project_id":524379,"asset_id":581806,"created_at":"2023-04-28T19:25:02.922+08:00","updated_at":"2023-04-28T19:25:02.922+08:00"},{"id":11943042,"file_name":"bg.png","project_id":524379,"asset_id":581807,"created_at":"2023-04-28T19:25:02.923+08:00","updated_at":"2023-04-28T19:25:02.923+08:00"},{"id":11943043,"file_name":"baby_1.png","project_id":524379,"asset_id":581808,"created_at":"2023-04-28T19:25:02.924+08:00","updated_at":"2023-04-28T19:25:02.924+08:00"},{"id":11943044,"file_name":"baby_0.png","project_id":524379,"asset_id":581809,"created_at":"2023-04-28T19:25:02.924+08:00","updated_at":"2023-04-28T19:25:02.924+08:00"},{"id":11943045,"file_name":"win.mp3","project_id":524379,"asset_id":581810,"created_at":"2023-04-28T19:25:02.925+08:00","updated_at":"2023-04-28T19:25:02.925+08:00"},{"id":11943046,"file_name":"fail.mp3","project_id":524379,"asset_id":581811,"created_at":"2023-04-28T19:25:02.926+08:00","updated_at":"2023-04-28T19:25:02.926+08:00"},{"id":11943047,"file_name":"dad_1.png","project_id":524379,"asset_id":581812,"created_at":"2023-04-28T19:25:02.927+08:00","updated_at":"2023-04-28T19:25:02.927+08:00"},{"id":11943048,"file_name":"mom_1.png","project_id":524379,"asset_id":581813,"created_at":"2023-04-28T19:25:02.928+08:00","updated_at":"2023-04-28T19:25:02.928+08:00"},{"id":11943049,"file_name":"mom_0.png","project_id":524379,"asset_id":581814,"created_at":"2023-04-28T19:25:02.929+08:00","updated_at":"2023-04-28T19:25:02.929+08:00"},{"id":11943050,"file_name":"dad_0.png","project_id":524379,"asset_id":581815,"created_at":"2023-04-28T19:25:02.930+08:00","updated_at":"2023-04-28T19:25:02.930+08:00"},{"id":11943051,"file_name":"pick.mp3","project_id":524379,"asset_id":581816,"created_at":"2023-04-28T19:25:02.931+08:00","updated_at":"2023-04-28T19:25:02.931+08:00"},{"id":11943052,"file_name":"drop.mp3","project_id":524379,"asset_id":581817,"created_at":"2023-04-28T19:25:02.932+08:00","updated_at":"2023-04-28T19:25:02.932+08:00"},{"id":11943053,"file_name":"bgm.mp3","project_id":524379,"asset_id":581818,"created_at":"2023-04-28T19:25:02.933+08:00","updated_at":"2023-04-28T19:25:02.933+08:00"},{"id":11943054,"file_name":"timesup.png","project_id":524379,"asset_id":581819,"created_at":"2023-04-28T19:25:02.934+08:00","updated_at":"2023-04-28T19:25:02.934+08:00"},{"id":11943055,"file_name":"success.png","project_id":524379,"asset_id":581820,"created_at":"2023-04-28T19:25:02.935+08:00","updated_at":"2023-04-28T19:25:02.935+08:00"},{"id":11943056,"file_name":"p_5.png","project_id":524379,"asset_id":581821,"created_at":"2023-04-28T19:25:02.936+08:00","updated_at":"2023-04-28T19:25:02.936+08:00"},{"id":11943057,"file_name":"p_4.png","project_id":524379,"asset_id":581822,"created_at":"2023-04-28T19:25:02.937+08:00","updated_at":"2023-04-28T19:25:02.937+08:00"},{"id":11943058,"file_name":"p_3.png","project_id":524379,"asset_id":581823,"created_at":"2023-04-28T19:25:02.938+08:00","updated_at":"2023-04-28T19:25:02.938+08:00"},{"id":11943059,"file_name":"info.png","project_id":524379,"asset_id":581824,"created_at":"2023-04-28T19:25:02.938+08:00","updated_at":"2023-04-28T19:25:02.938+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦