{"id":331972,"student_id":10,"content":"createSprite('cover.png'); //設定背景圖\nlet player = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png', '10.png'); //企鵝\nlet item = createSprite('item_0.png', 'item_1.png', 'item_2.png', 'item_3.png'); //拋出物品\nlet number = createSprite('n_1.png', 'n_2.png', 'n_3.png', 'n_4.png', 'n_5.png'); //倒數數字\nlet info = createSprite('info.png', 'next.png', 'end.png'); //遊戲說明、下個關卡、遊戲結束\nlet sight = createSprite('target.png'); //準星\n\nlet blocks = []; //存放冰塊角色的陣列\nlet level = 0; //等級\nlet timer = 0; //計時器\nlet target; //目標冰塊\nlet vy = 0; //物品下降速度\nlet count = 0; //紅寶石數量\nlet score = 0; //金塊數量\nlet clock = 0; //動畫計時器\n\nfor (let y = 0; y \u003c 6; y++) {\n for (let x = 0; x \u003c 10; x++) {\n let b = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_4.png', 'b_4.png', 'b_4.png');\n b.x = x * 100 + 150;\n b.y = y * 100 + 150;\n if (x % 2 == 0) b.y -= 50;\n b.on('click', function () {\n if (b.costumeId \u003e 3 \u0026\u0026 timer \u003c 900) {\n target = b; //點擊冰塊設定目標\n }\n });\n b.layer = -1;\n blocks.push(b);\n }\n}\n\nplayer.rotationStyle = 'fixed';\nnumber.opacity = 0.3;\n\n//開始每個關卡\nfunction startLevel () {\n level += 1; //每進入一個關卡等級 +1\n count = 0; //紅寶石數量歸零\n timer = 1200; //重置計時器\n target = undefined; //取消目標物\n info.hidden = true; //隱藏說明\n player.moveTo(600, 450); //重置玩家企鵝\n item.moveTo(600, 1000); //移動到畫面外\n\n for (let i = 0; i \u003c 60; i++) {\n if (i \u003c 17) blocks[i].costumeId = 1;\n else if (i \u003c 20) blocks[i].costumeId = 3;\n else if (i \u003c 20 + level) blocks[i].costumeId = 2;\n else blocks[i].costumeId = 0;\n }\n shuffle();\n}\n\n//冰塊隨機互換\nfunction shuffle () {\n for (let i = 0; i \u003c 100; i++) {\n let randA = Math.floor(Math.random() * 60); //隨機整數 0 - 59\n let randB = Math.floor(Math.random() * 60); //隨機整數 0 - 59\n let a = blocks[randA].costumeId; //隨機取出 A 冰塊的造型編號\n let b = blocks[randB].costumeId; //隨機取出 B 冰塊的造型編號\n blocks[randA].costumeId = b; //交換造型編號\n blocks[randB].costumeId = a; //交換造型編號\n }\n}\n\n// 遊戲迴圈\nfunction gameloop () {\n sight.moveTo(cursor); //準星不斷跟著滑鼠移動\n if (info.hidden) {\n updateTimer(); //更新計時器\n updatePlayer(); //更新企鵝角色\n updateTexts(); //引出計分板文字\n updateItem(); //拋出動畫\n }\n}\n\n// 更新企鵝\nfunction updatePlayer () {\n if (target != undefined) {\n player.toward(target); //朝向目標\n player.stepForward(6); //向前移動\n player.costumeId = Math.floor(timer / 12) % 2; //走路動畫\n player.costumeId += Math.floor(player.direction / 90) * 2; //根據方向切換造型\n if (player.distanceTo(target) \u003c 6) {\n target.costumeId -= 4;\n item.moveTo(player);\n item.costumeId = target.costumeId;\n vy = -10;\n if (target.costumeId == 1) score += 1; //挖到金塊\n if (target.costumeId == 2) count += 1; //挖到紅寶石\n if (target.costumeId == 3) {\n count = 0; // 清空紅寶石\n timer = 0; //挖到炸彈時間歸零\n player.costumeId = 10; //變成烤焦造型\n }\n clock = 20; //動畫時間\n target = undefined;\n }\n }\n\n //挖冰塊的動畫\n if (player.costumeId != 10) {\n clock -= 1;\n if (clock \u003e 10) player.costumeId = 8; //挖下動作\n else if (clock \u003e 0) player.costumeId = 9; //挖起動作\n }\n}\n\n//更新計時器\nfunction updateTimer () {\n if (timer \u003e 0) timer -= 1; //時間減少 1\n if (timer == 0) timeout(); //時間到\n if (timer == 900) hideAll(); //蓋上冰塊\n number.hidden = timer \u003e= 300 \u0026\u0026 timer \u003c= 900; //顯示倒數數字\n number.costumeId = Math.floor(timer / 60) % 5; //切換倒數數字造型\n}\n\n//時間到\nfunction timeout () {\n info.hidden = false; //顯示\n info.costumeId = count == level ? 1 : 2;\n}\n\n//隱藏全部寶石\nfunction hideAll () {\n for (let i = 0; i \u003c 60; i++) {\n blocks[i].costumeId += 4;\n }\n}\n\n//更新拋出的物品\nfunction updateItem () {\n vy += 0.5; //向下速度增加\n item.y += vy; //改變垂直 y 座標\n item.direction += 10; //旋轉\n}\n\n//顯示計分板上的文字\nfunction updateTexts () {\n drawText(Math.floor(timer / 60), 250, 830, 'white', 50); //剩餘時間\n drawText(score, 650, 830, 'white', 50); //金塊數量\n drawText(count, 1050, 830, 'white', 50); //紅寶石數量\n}\n\n//點擊遊戲說明圖\nfunction infoOnClick () {\n if (info.costumeId == 2) {\n let result = createSprite('end_0.png', 'end_1.png', 'end_2.png', 'end_3.png', 'end_4.png', 'end_5.png'); //創造企鵝解鎖圖\n result.costumeId = Math.floor(score / 10); //根據分數切換解鎖等級\n if (result.costumeId \u003e 5) result.costumeId = 5; //最高只能解鎖至最後一張\n info.destroy(); //隱藏說明圖\n } else {\n startLevel(); //開始新的一局\n }\n}\n\nforever(gameloop);\ninfo.on('click', infoOnClick);\n","created_at":"2021-12-28T16:25:14.709+08:00","updated_at":"2022-11-16T16:31:25.220+08:00","name":"企鵝挖寶(預設版)","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/331972/408813011caae7a76fc46cb489050fd6.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":217,"hashid":"wdks46rkm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":7037243,"file_name":"item_0.png","project_id":331972,"asset_id":456195,"created_at":"2021-12-28T16:25:28.349+08:00","updated_at":"2021-12-28T16:25:28.349+08:00"},{"id":7037244,"file_name":"10.png","project_id":331972,"asset_id":456196,"created_at":"2021-12-28T16:25:28.356+08:00","updated_at":"2021-12-28T16:25:28.356+08:00"},{"id":7037245,"file_name":"9.png","project_id":331972,"asset_id":456197,"created_at":"2021-12-28T16:25:28.362+08:00","updated_at":"2021-12-28T16:25:28.362+08:00"},{"id":7037246,"file_name":"8.png","project_id":331972,"asset_id":456198,"created_at":"2021-12-28T16:25:28.369+08:00","updated_at":"2021-12-28T16:25:28.369+08:00"},{"id":7037247,"file_name":"3.png","project_id":331972,"asset_id":456199,"created_at":"2021-12-28T16:25:28.375+08:00","updated_at":"2021-12-28T16:25:28.375+08:00"},{"id":7037248,"file_name":"5.png","project_id":331972,"asset_id":456200,"created_at":"2021-12-28T16:25:28.381+08:00","updated_at":"2021-12-28T16:25:28.381+08:00"},{"id":7037249,"file_name":"2.png","project_id":331972,"asset_id":456201,"created_at":"2021-12-28T16:25:28.388+08:00","updated_at":"2021-12-28T16:25:28.388+08:00"},{"id":7037250,"file_name":"4.png","project_id":331972,"asset_id":456202,"created_at":"2021-12-28T16:25:28.394+08:00","updated_at":"2021-12-28T16:25:28.394+08:00"},{"id":7037251,"file_name":"1.png","project_id":331972,"asset_id":456203,"created_at":"2021-12-28T16:25:28.400+08:00","updated_at":"2021-12-28T16:25:28.400+08:00"},{"id":7037252,"file_name":"7.png","project_id":331972,"asset_id":456204,"created_at":"2021-12-28T16:25:28.406+08:00","updated_at":"2021-12-28T16:25:28.406+08:00"},{"id":7037253,"file_name":"0.png","project_id":331972,"asset_id":456205,"created_at":"2021-12-28T16:25:28.413+08:00","updated_at":"2021-12-28T16:25:28.413+08:00"},{"id":7037254,"file_name":"6.png","project_id":331972,"asset_id":456206,"created_at":"2021-12-28T16:25:28.419+08:00","updated_at":"2021-12-28T16:25:28.419+08:00"},{"id":7037255,"file_name":"gameover.png","project_id":331972,"asset_id":456207,"created_at":"2021-12-28T16:25:28.426+08:00","updated_at":"2021-12-28T16:25:28.426+08:00"},{"id":7037256,"file_name":"end.png","project_id":331972,"asset_id":456208,"created_at":"2021-12-28T16:25:28.438+08:00","updated_at":"2021-12-28T16:25:28.438+08:00"},{"id":7037257,"file_name":"end_5.png","project_id":331972,"asset_id":456209,"created_at":"2021-12-28T16:25:28.445+08:00","updated_at":"2021-12-28T16:25:28.445+08:00"},{"id":7037258,"file_name":"end_4.png","project_id":331972,"asset_id":456210,"created_at":"2021-12-28T16:25:28.452+08:00","updated_at":"2021-12-28T16:25:28.452+08:00"},{"id":7037259,"file_name":"end_3.png","project_id":331972,"asset_id":456211,"created_at":"2021-12-28T16:25:28.458+08:00","updated_at":"2021-12-28T16:25:28.458+08:00"},{"id":7037260,"file_name":"end_2.png","project_id":331972,"asset_id":456212,"created_at":"2021-12-28T16:25:28.465+08:00","updated_at":"2021-12-28T16:25:28.465+08:00"},{"id":7037261,"file_name":"end_1.png","project_id":331972,"asset_id":456213,"created_at":"2021-12-28T16:25:28.474+08:00","updated_at":"2021-12-28T16:25:28.474+08:00"},{"id":7037262,"file_name":"end_0.png","project_id":331972,"asset_id":456214,"created_at":"2021-12-28T16:25:28.481+08:00","updated_at":"2021-12-28T16:25:28.481+08:00"},{"id":7037263,"file_name":"b_4.png","project_id":331972,"asset_id":456215,"created_at":"2021-12-28T16:25:28.500+08:00","updated_at":"2021-12-28T16:25:28.500+08:00"},{"id":7037264,"file_name":"b_0.png","project_id":331972,"asset_id":456216,"created_at":"2021-12-28T16:25:28.506+08:00","updated_at":"2021-12-28T16:25:28.506+08:00"},{"id":7037265,"file_name":"b_2.png","project_id":331972,"asset_id":456217,"created_at":"2021-12-28T16:25:28.512+08:00","updated_at":"2021-12-28T16:25:28.512+08:00"},{"id":7037266,"file_name":"b_1.png","project_id":331972,"asset_id":456218,"created_at":"2021-12-28T16:25:28.517+08:00","updated_at":"2021-12-28T16:25:28.517+08:00"},{"id":7037267,"file_name":"b_3.png","project_id":331972,"asset_id":456219,"created_at":"2021-12-28T16:25:28.523+08:00","updated_at":"2021-12-28T16:25:28.523+08:00"},{"id":7037268,"file_name":"board.png","project_id":331972,"asset_id":456220,"created_at":"2021-12-28T16:25:28.529+08:00","updated_at":"2021-12-28T16:25:28.529+08:00"},{"id":7037269,"file_name":"item_3.png","project_id":331972,"asset_id":456221,"created_at":"2021-12-28T16:25:28.535+08:00","updated_at":"2021-12-28T16:25:28.535+08:00"},{"id":7037270,"file_name":"item_1.png","project_id":331972,"asset_id":456222,"created_at":"2021-12-28T16:25:28.540+08:00","updated_at":"2021-12-28T16:25:28.540+08:00"},{"id":7037271,"file_name":"item_2.png","project_id":331972,"asset_id":456223,"created_at":"2021-12-28T16:25:28.546+08:00","updated_at":"2021-12-28T16:25:28.546+08:00"},{"id":7037272,"file_name":"info.png","project_id":331972,"asset_id":456224,"created_at":"2021-12-28T16:25:28.552+08:00","updated_at":"2021-12-28T16:25:28.552+08:00"},{"id":7037273,"file_name":"n_1.png","project_id":331972,"asset_id":456225,"created_at":"2021-12-28T16:25:28.559+08:00","updated_at":"2021-12-28T16:25:28.559+08:00"},{"id":7037274,"file_name":"n_2.png","project_id":331972,"asset_id":456226,"created_at":"2021-12-28T16:25:28.564+08:00","updated_at":"2021-12-28T16:25:28.564+08:00"},{"id":7037275,"file_name":"n_3.png","project_id":331972,"asset_id":456227,"created_at":"2021-12-28T16:25:28.570+08:00","updated_at":"2021-12-28T16:25:28.570+08:00"},{"id":7037276,"file_name":"n_4.png","project_id":331972,"asset_id":456228,"created_at":"2021-12-28T16:25:28.576+08:00","updated_at":"2021-12-28T16:25:28.576+08:00"},{"id":7037277,"file_name":"n_5.png","project_id":331972,"asset_id":456229,"created_at":"2021-12-28T16:25:28.582+08:00","updated_at":"2021-12-28T16:25:28.582+08:00"},{"id":7037278,"file_name":"next.png","project_id":331972,"asset_id":456230,"created_at":"2021-12-28T16:25:28.588+08:00","updated_at":"2021-12-28T16:25:28.588+08:00"},{"id":7037279,"file_name":"target.png","project_id":331972,"asset_id":456231,"created_at":"2021-12-28T16:25:28.596+08:00","updated_at":"2021-12-28T16:25:28.596+08:00"},{"id":7037280,"file_name":"cover.png","project_id":331972,"asset_id":456232,"created_at":"2021-12-28T16:25:28.604+08:00","updated_at":"2021-12-28T16:25:28.604+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦