{"id":354406,"student_id":10,"content":"let blockImgs = ['b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png'];\nlet numberImgs = ['0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'];\nlet bg = createSprite('bg.png'); //背景\nlet hilltop = createSprite('hilltop.png'); //山頂背景\nlet b1 = createSprite(blockImgs); //障礙物1\nlet b2 = createSprite(blockImgs); //障礙物2\nlet b3 = createSprite(blockImgs); //障礙物3\nlet b4 = createSprite(blockImgs); //障礙物4\nlet n1 = createSprite(numberImgs); //分數個位數\nlet n2 = createSprite(numberImgs); //分數十位數\nlet n3 = createSprite(numberImgs); //分數百位數\nlet passerby = createSprite('y_0.png', 'y_1.png'); //路人叩叮\nlet player = createSprite('r_0.png', 'r_1.png', 'r_2.png', 'r_3.png'); //玩家\nlet monster = createSprite('m_0.png', 'm_1.png', 'm_2.png'); //雪怪\nlet enterBtn = createSprite('enter_btn.png'); // 重新開始提示按鍵\n\nlet isStart = false; // 是否開始遊戲\nlet speed = 6; // 速度\nlet score = 0; // 分數\n\nreset(); // 初始化\n\n// 重置所有角色與變數\nfunction reset () {\n hilltop.y = 450;\n bg.y = 1800;\n n1.moveTo(50, 50);\n n2.moveTo(100, 50);\n n3.moveTo(150, 50);\n b1.moveTo(1300, 0);\n b2.moveTo(1300, 300);\n b3.moveTo(1300, 600);\n b4.moveTo(1300, 900);\n monster.y = -1000;\n player.x = 600;\n passerby.y = 1200;\n enterBtn.y = 700;\n enterBtn.hidden = true;\n player.costumeId = 0;\n isStart = false;\n speed = 6;\n score = 0;\n}\n\n// 遊戲主迴圈\nfunction gameloop () {\n if (isStart) {\n updatePlayer(); //更新玩家\n updateMonster(); //更新雪怪\n updateGround(); //更新背景\n updateBlock(b1); //更新障礙物1\n updateBlock(b2); //更新障礙物2\n updateBlock(b3); //更新障礙物3\n updateBlock(b4); //更新障礙物4\n updatePasserby(); //更新路人叩叮\n updateScore(); //更新分數\n speedUp(); //提高遊戲速度\n }\n}\n\n// 更新背景圖\nfunction updateGround () {\n bg.y -= 6;\n hilltop.y -= 6;\n if (bg.y \u003c 0) {\n bg.y += 900;\n }\n}\n\n// 更新障礙物\nfunction updateBlock (block) {\n block.y -= 6;\n if (block.y \u003c -50) {\n block.y += 1200;\n block.x = 100 + Math.random() * 1000;\n block.costumeId = Math.floor(Math.random() * 6);\n block.scale = 1.3;\n }\n if (block.touched(player) \u0026\u0026 block.y \u003e player.y) {\n gameover();\n }\n}\n\n// 更新玩家\nfunction updatePlayer () {\n\n player.costumeId = 0;\n\n if (key.right) {\n player.x += 9;\n player.costumeId = 1;\n }\n\n if (key.left) {\n player.x -= 9;\n player.costumeId = 2;\n }\n}\n\n// 更新雪怪\nfunction updateMonster () {\n \n}\n\n// 更新路人叩叮\nfunction updatePasserby () {\n passerby.y -= 3;\n if (passerby.y \u003c -100) {\n passerby.y += 1200;\n passerby.x = Math.random() * 1000 + 100;\n passerby.costumeId = 0;\n }\n \n if (passerby.touched(player) \u0026\u0026 passerby.costumeId == 0) {\n passerby.costumeId = 1;\n score += 10;\n }\n}\n\n// 更新分數\nfunction updateScore () {\n score += 0.01;\n n1.costumeId = Math.floor(score / 100) % 10;\n n2.costumeId = Math.floor(score / 10) % 10;\n n3.costumeId = Math.floor(score / 1) % 10;\n}\n\n// 遊戲結束\nfunction gameover () {\n player.costumeId = 3; // 玩家跌倒\n monster.costumeId = 2; // 雪怪嘲笑\n enterBtn.hidden = false; // 顯示重新開始提示\n stop();\n}\n\n// 提高遊戲速度\nfunction speedUp () {\n if (speed \u003c 12) {\n speed += 0.001;\n }\n}\n\nforever(gameloop);","created_at":"2022-03-10T13:01:33.161+08:00","updated_at":"2022-03-10T13:02:43.146+08:00","name":"逃離雪怪(預設版) ","language":"javascript","screenshot":{"url":null},"parent_id":354237,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":161,"hashid":"5j3s9yvde","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":7721148,"file_name":"y_1.png","project_id":354406,"asset_id":483957,"created_at":"2022-03-10T13:01:33.168+08:00","updated_at":"2022-03-10T13:01:33.168+08:00"},{"id":7721149,"file_name":"m_1.png","project_id":354406,"asset_id":348734,"created_at":"2022-03-10T13:01:33.169+08:00","updated_at":"2022-03-10T13:01:33.169+08:00"},{"id":7721150,"file_name":"m_2.png","project_id":354406,"asset_id":348735,"created_at":"2022-03-10T13:01:33.171+08:00","updated_at":"2022-03-10T13:01:33.171+08:00"},{"id":7721151,"file_name":"r_3.png","project_id":354406,"asset_id":435235,"created_at":"2022-03-10T13:01:33.172+08:00","updated_at":"2022-03-10T13:01:33.172+08:00"},{"id":7721152,"file_name":"r_2.png","project_id":354406,"asset_id":435234,"created_at":"2022-03-10T13:01:33.173+08:00","updated_at":"2022-03-10T13:01:33.173+08:00"},{"id":7721153,"file_name":"2.png","project_id":354406,"asset_id":348722,"created_at":"2022-03-10T13:01:33.174+08:00","updated_at":"2022-03-10T13:01:33.174+08:00"},{"id":7721154,"file_name":"3.png","project_id":354406,"asset_id":348723,"created_at":"2022-03-10T13:01:33.174+08:00","updated_at":"2022-03-10T13:01:33.174+08:00"},{"id":7721155,"file_name":"4.png","project_id":354406,"asset_id":348724,"created_at":"2022-03-10T13:01:33.175+08:00","updated_at":"2022-03-10T13:01:33.175+08:00"},{"id":7721156,"file_name":"5.png","project_id":354406,"asset_id":348725,"created_at":"2022-03-10T13:01:33.176+08:00","updated_at":"2022-03-10T13:01:33.176+08:00"},{"id":7721157,"file_name":"8.png","project_id":354406,"asset_id":348728,"created_at":"2022-03-10T13:01:33.177+08:00","updated_at":"2022-03-10T13:01:33.177+08:00"},{"id":7721158,"file_name":"9.png","project_id":354406,"asset_id":348729,"created_at":"2022-03-10T13:01:33.178+08:00","updated_at":"2022-03-10T13:01:33.178+08:00"},{"id":7721159,"file_name":"6.png","project_id":354406,"asset_id":348726,"created_at":"2022-03-10T13:01:33.179+08:00","updated_at":"2022-03-10T13:01:33.179+08:00"},{"id":7721160,"file_name":"7.png","project_id":354406,"asset_id":348727,"created_at":"2022-03-10T13:01:33.180+08:00","updated_at":"2022-03-10T13:01:33.180+08:00"},{"id":7721161,"file_name":"y_0.png","project_id":354406,"asset_id":348740,"created_at":"2022-03-10T13:01:33.181+08:00","updated_at":"2022-03-10T13:01:33.181+08:00"},{"id":7721162,"file_name":"show.wav","project_id":354406,"asset_id":333560,"created_at":"2022-03-10T13:01:33.182+08:00","updated_at":"2022-03-10T13:01:33.182+08:00"},{"id":7721163,"file_name":"ouch.wav","project_id":354406,"asset_id":333559,"created_at":"2022-03-10T13:01:33.183+08:00","updated_at":"2022-03-10T13:01:33.183+08:00"},{"id":7721164,"file_name":"bgm.mp3","project_id":354406,"asset_id":333558,"created_at":"2022-03-10T13:01:33.184+08:00","updated_at":"2022-03-10T13:01:33.184+08:00"},{"id":7721165,"file_name":"bg.png","project_id":354406,"asset_id":348730,"created_at":"2022-03-10T13:01:33.185+08:00","updated_at":"2022-03-10T13:01:33.185+08:00"},{"id":7721166,"file_name":"enter_btn.png","project_id":354406,"asset_id":348731,"created_at":"2022-03-10T13:01:33.185+08:00","updated_at":"2022-03-10T13:01:33.185+08:00"},{"id":7721167,"file_name":"0.png","project_id":354406,"asset_id":348720,"created_at":"2022-03-10T13:01:33.186+08:00","updated_at":"2022-03-10T13:01:33.186+08:00"},{"id":7721168,"file_name":"1.png","project_id":354406,"asset_id":348721,"created_at":"2022-03-10T13:01:33.187+08:00","updated_at":"2022-03-10T13:01:33.187+08:00"},{"id":7721169,"file_name":"m_0.png","project_id":354406,"asset_id":348733,"created_at":"2022-03-10T13:01:33.188+08:00","updated_at":"2022-03-10T13:01:33.188+08:00"},{"id":7721170,"file_name":"r_0.png","project_id":354406,"asset_id":435232,"created_at":"2022-03-10T13:01:33.189+08:00","updated_at":"2022-03-10T13:01:33.189+08:00"},{"id":7721171,"file_name":"r_1.png","project_id":354406,"asset_id":435233,"created_at":"2022-03-10T13:01:33.190+08:00","updated_at":"2022-03-10T13:01:33.190+08:00"},{"id":7721172,"file_name":"b_2.png","project_id":354406,"asset_id":348743,"created_at":"2022-03-10T13:01:33.191+08:00","updated_at":"2022-03-10T13:01:33.191+08:00"},{"id":7721173,"file_name":"b_0.png","project_id":354406,"asset_id":348741,"created_at":"2022-03-10T13:01:33.192+08:00","updated_at":"2022-03-10T13:01:33.192+08:00"},{"id":7721174,"file_name":"b_1.png","project_id":354406,"asset_id":348742,"created_at":"2022-03-10T13:01:33.193+08:00","updated_at":"2022-03-10T13:01:33.193+08:00"},{"id":7721175,"file_name":"b_3.png","project_id":354406,"asset_id":348745,"created_at":"2022-03-10T13:01:33.193+08:00","updated_at":"2022-03-10T13:01:33.193+08:00"},{"id":7721176,"file_name":"hilltop.png","project_id":354406,"asset_id":483959,"created_at":"2022-03-10T13:01:33.194+08:00","updated_at":"2022-03-10T13:01:33.194+08:00"},{"id":7721177,"file_name":"b_5.png","project_id":354406,"asset_id":348746,"created_at":"2022-03-10T13:01:33.195+08:00","updated_at":"2022-03-10T13:01:33.195+08:00"},{"id":7721178,"file_name":"b_4.png","project_id":354406,"asset_id":348744,"created_at":"2022-03-10T13:01:33.196+08:00","updated_at":"2022-03-10T13:01:33.196+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦