{"id":329038,"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', 'gameover.png');\nlet sight = createSprite('target.png'); //準星\n\nlet blocks = []; // 存放冰塊的陣列\nlet level = 1; // 等級\nlet timer = 0; // 計時器\nlet target; // 目標冰塊\nlet vy = 0; // 物品下降速度\nlet count = 0; // 紅寶石數量\nlet score = 0; // 金塊數量\nlet clock = 0; // 動畫計時器\n\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\n b.layer = -1;\n b.on('click', setTarget); // 冰塊被點擊時設定成目標\n blocks.push(b); // 存入冰塊陣列\n }\n}\n\nplayer.rotationStyle = 'fixed';\nnumber.opacity = 0.3;\n\n// 開始每個關卡\nfunction startLevel () {\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 blocks.length; i++) {\n blocks[i].costumeId = 0;\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 }\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);\n let randB = Math.floor(Math.random() * 60);\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\nfunction gameloop () {\n sight.moveTo(cursor); // 準星不斷跟著滑鼠移動\n\n // 如果遊戲說明、結束圖隱藏\n if (info.hidden) {\n updateTimer(); // 更新計時器\n updatePlayer(); // 更新企鵝角色\n updateitem(); // 更新寶石\n updateTexts(); // 引出計分板文字\n }\n}\n\n\nfunction updatePlayer () {\n\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\n // 如果距離目標物低於 6\n if (player.distanceTo(target) \u003c 6) {\n target.costumeId -= 4;\n if (target.costumeId == 1) score += 1;\n if (target.costumeId == 2) count += 1;\n if (target.costumeId == 3) {\n timer = 0;\n player.costumeId = 10;\n }\n clock = 20;\n item.moveTo(player);\n item.costumeId = target.costumeId;\n vy = -10;\n target = undefined; //取消目標\n }\n }\n \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;\n if (timer == 900) hideAll();\n if (timer == 0) timeout();\n number.costumeId = Math.floor(timer / 60) % 5;\n number.hidden = (timer \u003c 900 \u0026\u0026 timer \u003e 300) || timer \u003c= 0;\n}\n\n// 隱藏全部寶石\nfunction hideAll () {\n for (let i = 0; i \u003c 60; i++) {\n blocks[i].costumeId += 4; // 蓋上冰塊\n }\n}\n\n// 時間到\nfunction timeout () {\n info.hidden = false;\n info.costumeId = level == count ? 1 : 2;\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.ceil(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 info.destroy();\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 / 5);\n if (result.costumeId \u003e 5) result.costumeId = 5;\n } else {\n level += 1;\n startLevel();\n }\n}\n\nfunction setTarget () {\n if (this.costumeId \u003e 3 \u0026\u0026 timer \u003c 900) {\n target = this;\n }\n}\n\nforever(gameloop); // 不斷執行遊戲迴圈\ninfo.on('click', infoOnClick);\nstartLevel(); // 測試,預設進入第一關","created_at":"2021-12-21T17:11:37.096+08:00","updated_at":"2022-06-30T15:35:45.251+08:00","name":"企鵝挖寶(預設版)","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/329038/9f11fd342eb754d0b2bb1e07aa03c7fd.jpg"},"parent_id":326660,"plugin":"Game.set({width: 1200, height: 900});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":222,"hashid":"vngsyq856","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6944996,"file_name":"cover.png","project_id":329038,"asset_id":453655,"created_at":"2021-12-21T17:11:37.103+08:00","updated_at":"2021-12-21T17:11:37.103+08:00"},{"id":6945010,"file_name":"target.png","project_id":329038,"asset_id":453649,"created_at":"2021-12-21T17:11:37.116+08:00","updated_at":"2021-12-21T17:11:37.116+08:00"},{"id":6945011,"file_name":"next.png","project_id":329038,"asset_id":453634,"created_at":"2021-12-21T17:11:37.116+08:00","updated_at":"2021-12-21T17:11:37.116+08:00"},{"id":6945012,"file_name":"n_5.png","project_id":329038,"asset_id":453633,"created_at":"2021-12-21T17:11:37.117+08:00","updated_at":"2021-12-21T17:11:37.117+08:00"},{"id":6945013,"file_name":"n_4.png","project_id":329038,"asset_id":453632,"created_at":"2021-12-21T17:11:37.118+08:00","updated_at":"2021-12-21T17:11:37.118+08:00"},{"id":6945014,"file_name":"n_3.png","project_id":329038,"asset_id":453631,"created_at":"2021-12-21T17:11:37.119+08:00","updated_at":"2021-12-21T17:11:37.119+08:00"},{"id":6945015,"file_name":"n_2.png","project_id":329038,"asset_id":453630,"created_at":"2021-12-21T17:11:37.120+08:00","updated_at":"2021-12-21T17:11:37.120+08:00"},{"id":6945016,"file_name":"n_1.png","project_id":329038,"asset_id":453629,"created_at":"2021-12-21T17:11:37.121+08:00","updated_at":"2021-12-21T17:11:37.121+08:00"},{"id":6945017,"file_name":"info.png","project_id":329038,"asset_id":453628,"created_at":"2021-12-21T17:11:37.121+08:00","updated_at":"2021-12-21T17:11:37.121+08:00"},{"id":6945029,"file_name":"board.png","project_id":329038,"asset_id":453615,"created_at":"2021-12-21T17:11:37.132+08:00","updated_at":"2021-12-21T17:11:37.132+08:00"},{"id":6945033,"file_name":"b_2.png","project_id":329038,"asset_id":453611,"created_at":"2021-12-21T17:11:37.135+08:00","updated_at":"2021-12-28T11:02:19.933+08:00"},{"id":6945034,"file_name":"b_0.png","project_id":329038,"asset_id":453610,"created_at":"2021-12-21T17:11:37.136+08:00","updated_at":"2021-12-28T11:01:20.174+08:00"},{"id":6945030,"file_name":"b_3.png","project_id":329038,"asset_id":453614,"created_at":"2021-12-21T17:11:37.132+08:00","updated_at":"2021-12-28T11:02:31.122+08:00"},{"id":6945031,"file_name":"b_1.png","project_id":329038,"asset_id":453613,"created_at":"2021-12-21T17:11:37.133+08:00","updated_at":"2021-12-28T11:02:26.915+08:00"},{"id":6945035,"file_name":"b_4.png","project_id":329038,"asset_id":451275,"created_at":"2021-12-21T17:11:37.137+08:00","updated_at":"2021-12-28T11:02:34.647+08:00"},{"id":6945020,"file_name":"item_1.png","project_id":329038,"asset_id":453625,"created_at":"2021-12-21T17:11:37.124+08:00","updated_at":"2021-12-28T11:03:08.979+08:00"},{"id":6945018,"file_name":"item_2.png","project_id":329038,"asset_id":453627,"created_at":"2021-12-21T17:11:37.122+08:00","updated_at":"2021-12-28T11:03:13.868+08:00"},{"id":6945028,"file_name":"item_3.png","project_id":329038,"asset_id":453616,"created_at":"2021-12-21T17:11:37.131+08:00","updated_at":"2021-12-28T11:03:17.423+08:00"},{"id":7035563,"file_name":"7.png","project_id":329038,"asset_id":456126,"created_at":"2021-12-27T17:15:02.380+08:00","updated_at":"2021-12-27T17:15:02.380+08:00"},{"id":7035564,"file_name":"1.png","project_id":329038,"asset_id":456127,"created_at":"2021-12-27T17:15:02.382+08:00","updated_at":"2021-12-27T17:15:02.382+08:00"},{"id":7035553,"file_name":"end_0.png","project_id":329038,"asset_id":456117,"created_at":"2021-12-27T17:12:24.609+08:00","updated_at":"2021-12-27T17:12:24.609+08:00"},{"id":7035554,"file_name":"end_1.png","project_id":329038,"asset_id":456118,"created_at":"2021-12-27T17:12:24.614+08:00","updated_at":"2021-12-27T17:12:24.614+08:00"},{"id":7035565,"file_name":"4.png","project_id":329038,"asset_id":456128,"created_at":"2021-12-27T17:15:02.983+08:00","updated_at":"2021-12-27T17:15:02.983+08:00"},{"id":7035566,"file_name":"2.png","project_id":329038,"asset_id":456129,"created_at":"2021-12-27T17:15:02.985+08:00","updated_at":"2021-12-27T17:15:02.985+08:00"},{"id":7035567,"file_name":"5.png","project_id":329038,"asset_id":456130,"created_at":"2021-12-27T17:15:04.065+08:00","updated_at":"2021-12-27T17:15:04.065+08:00"},{"id":7035568,"file_name":"3.png","project_id":329038,"asset_id":456131,"created_at":"2021-12-27T17:15:04.067+08:00","updated_at":"2021-12-27T17:15:04.067+08:00"},{"id":7035569,"file_name":"8.png","project_id":329038,"asset_id":456132,"created_at":"2021-12-27T17:15:23.839+08:00","updated_at":"2021-12-27T17:15:23.839+08:00"},{"id":7035570,"file_name":"9.png","project_id":329038,"asset_id":456133,"created_at":"2021-12-27T17:15:23.840+08:00","updated_at":"2021-12-27T17:15:23.840+08:00"},{"id":7035552,"file_name":"item_0.png","project_id":329038,"asset_id":456116,"created_at":"2021-12-27T16:30:53.499+08:00","updated_at":"2021-12-28T11:03:04.521+08:00"},{"id":7035557,"file_name":"end_4.png","project_id":329038,"asset_id":456121,"created_at":"2021-12-27T17:12:26.616+08:00","updated_at":"2021-12-27T17:12:26.616+08:00"},{"id":7035558,"file_name":"end_5.png","project_id":329038,"asset_id":456122,"created_at":"2021-12-27T17:12:26.618+08:00","updated_at":"2021-12-27T17:12:26.618+08:00"},{"id":7035559,"file_name":"end.png","project_id":329038,"asset_id":453624,"created_at":"2021-12-27T17:13:12.781+08:00","updated_at":"2021-12-27T17:13:12.781+08:00"},{"id":7035560,"file_name":"gameover.png","project_id":329038,"asset_id":456123,"created_at":"2021-12-27T17:13:12.783+08:00","updated_at":"2021-12-27T17:13:12.783+08:00"},{"id":7035555,"file_name":"end_2.png","project_id":329038,"asset_id":456119,"created_at":"2021-12-27T17:12:25.600+08:00","updated_at":"2021-12-27T17:12:25.600+08:00"},{"id":7035556,"file_name":"end_3.png","project_id":329038,"asset_id":456120,"created_at":"2021-12-27T17:12:25.602+08:00","updated_at":"2021-12-27T17:12:25.602+08:00"},{"id":7035571,"file_name":"10.png","project_id":329038,"asset_id":456134,"created_at":"2021-12-27T17:15:24.467+08:00","updated_at":"2021-12-27T17:15:24.467+08:00"},{"id":7035561,"file_name":"6.png","project_id":329038,"asset_id":456124,"created_at":"2021-12-27T17:15:01.837+08:00","updated_at":"2021-12-27T17:15:01.837+08:00"},{"id":7035562,"file_name":"0.png","project_id":329038,"asset_id":456125,"created_at":"2021-12-27T17:15:01.839+08:00","updated_at":"2021-12-27T17:15:01.839+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦