{"id":470328,"student_id":10,"content":"let bg = createSprite('bg.png'); //背景\nlet hilltop = createSprite('hilltop.png'); //山頂背景\nlet b1 = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png'); //障礙物1\nlet b2 = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png'); //障礙物2\nlet b3 = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png'); //障礙物3\nlet b4 = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png'); //障礙物4\nlet n1 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //分數個位數\nlet n2 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //分數十位數\nlet n3 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //分數百位數\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 \u0026\u0026 enterBtn.hidden) {\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 if (key.enter) {\n reset();\n }\n}\n\n// 更新背景圖\nfunction updateGround () {\n bg.y -= speed;\n hilltop.y -= speed;\n if (bg.y \u003c 0) {\n bg.y += 900;\n }\n}\n\n// 更新障礙物\nfunction updateBlock (block) {\n block.y -= speed;\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 += speed * 1.5; //根據速度向右移動\n player.costumeId = 1; //呈現向右的造型圖\n }\n\n if (key.left) {\n player.x -= speed * 1.5; //根據速度向左移動\n player.costumeId = 2; //呈現向左的造型圖\n }\n}\n\n// 更新雪怪\nfunction updateMonster () {\n // 根據垂直 y 座標來回切換造型圖呈現走路動畫\n if (monster.y % 100 \u003c 50) {\n monster.costumeId = 0;\n } else {\n monster.costumeId = 1;\n }\n}\n\n// 更新路人叩叮\nfunction updatePasserby () {\n \n // 如果超出上方邊界\n if (passerby.y \u003c -100) {\n passerby.y += 1200; //重置到下方\n passerby.x = Math.random() * 1000 + 100; // 隨機切換水平位置\n passerby.costumeId = 0; // 恢復造型圖\n }\n \n // 如果撞到路人叩叮而且該路人叩叮正在滑雪\n if (passerby.touched(player) \u0026\u0026 passerby.costumeId == 0) {\n passerby.costumeId = 1; //切換跌倒的圖\n score += 10; //分數加 10\n }\n \n \n if (passerby.costumeId == 0) {\n passerby.y -= speed / 2; //正在滑雪向上速度慢於背景\n } else {\n passerby.y -= speed; //跌倒了向上速度與背景相同\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}\n\n// 提高遊戲速度\nfunction speedUp () {\n \n}\n\nforever(gameloop);","created_at":"2022-12-09T16:27:14.087+08:00","updated_at":"2022-12-09T16:27:14.087+08:00","name":"逃離雪怪(預設版) 副本","language":"javascript","screenshot":{"url":null},"parent_id":470326,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":155,"hashid":"zpesrky46","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":10694850,"file_name":"y_1.png","project_id":470328,"asset_id":588658,"created_at":"2022-12-09T16:27:14.093+08:00","updated_at":"2022-12-09T16:27:14.093+08:00"},{"id":10694851,"file_name":"m_1.png","project_id":470328,"asset_id":588659,"created_at":"2022-12-09T16:27:14.095+08:00","updated_at":"2022-12-09T16:27:14.095+08:00"},{"id":10694852,"file_name":"m_2.png","project_id":470328,"asset_id":588660,"created_at":"2022-12-09T16:27:14.096+08:00","updated_at":"2022-12-09T16:27:14.096+08:00"},{"id":10694853,"file_name":"r_3.png","project_id":470328,"asset_id":588661,"created_at":"2022-12-09T16:27:14.097+08:00","updated_at":"2022-12-09T16:27:14.097+08:00"},{"id":10694854,"file_name":"r_2.png","project_id":470328,"asset_id":588662,"created_at":"2022-12-09T16:27:14.099+08:00","updated_at":"2022-12-09T16:27:14.099+08:00"},{"id":10694855,"file_name":"2.png","project_id":470328,"asset_id":588663,"created_at":"2022-12-09T16:27:14.100+08:00","updated_at":"2022-12-09T16:27:14.100+08:00"},{"id":10694856,"file_name":"3.png","project_id":470328,"asset_id":588664,"created_at":"2022-12-09T16:27:14.101+08:00","updated_at":"2022-12-09T16:27:14.101+08:00"},{"id":10694857,"file_name":"4.png","project_id":470328,"asset_id":588665,"created_at":"2022-12-09T16:27:14.102+08:00","updated_at":"2022-12-09T16:27:14.102+08:00"},{"id":10694858,"file_name":"5.png","project_id":470328,"asset_id":588666,"created_at":"2022-12-09T16:27:14.103+08:00","updated_at":"2022-12-09T16:27:14.103+08:00"},{"id":10694859,"file_name":"8.png","project_id":470328,"asset_id":588667,"created_at":"2022-12-09T16:27:14.104+08:00","updated_at":"2022-12-09T16:27:14.104+08:00"},{"id":10694860,"file_name":"9.png","project_id":470328,"asset_id":588668,"created_at":"2022-12-09T16:27:14.105+08:00","updated_at":"2022-12-09T16:27:14.105+08:00"},{"id":10694861,"file_name":"6.png","project_id":470328,"asset_id":588669,"created_at":"2022-12-09T16:27:14.106+08:00","updated_at":"2022-12-09T16:27:14.106+08:00"},{"id":10694862,"file_name":"7.png","project_id":470328,"asset_id":588670,"created_at":"2022-12-09T16:27:14.107+08:00","updated_at":"2022-12-09T16:27:14.107+08:00"},{"id":10694863,"file_name":"y_0.png","project_id":470328,"asset_id":588671,"created_at":"2022-12-09T16:27:14.108+08:00","updated_at":"2022-12-09T16:27:14.108+08:00"},{"id":10694864,"file_name":"show.wav","project_id":470328,"asset_id":588672,"created_at":"2022-12-09T16:27:14.108+08:00","updated_at":"2022-12-09T16:27:14.108+08:00"},{"id":10694865,"file_name":"ouch.wav","project_id":470328,"asset_id":588673,"created_at":"2022-12-09T16:27:14.109+08:00","updated_at":"2022-12-09T16:27:14.109+08:00"},{"id":10694866,"file_name":"bgm.mp3","project_id":470328,"asset_id":588674,"created_at":"2022-12-09T16:27:14.110+08:00","updated_at":"2022-12-09T16:27:14.110+08:00"},{"id":10694867,"file_name":"bg.png","project_id":470328,"asset_id":588675,"created_at":"2022-12-09T16:27:14.111+08:00","updated_at":"2022-12-09T16:27:14.111+08:00"},{"id":10694868,"file_name":"enter_btn.png","project_id":470328,"asset_id":588676,"created_at":"2022-12-09T16:27:14.112+08:00","updated_at":"2022-12-09T16:27:14.112+08:00"},{"id":10694869,"file_name":"0.png","project_id":470328,"asset_id":588677,"created_at":"2022-12-09T16:27:14.113+08:00","updated_at":"2022-12-09T16:27:14.113+08:00"},{"id":10694870,"file_name":"1.png","project_id":470328,"asset_id":588678,"created_at":"2022-12-09T16:27:14.114+08:00","updated_at":"2022-12-09T16:27:14.114+08:00"},{"id":10694871,"file_name":"m_0.png","project_id":470328,"asset_id":588679,"created_at":"2022-12-09T16:27:14.115+08:00","updated_at":"2022-12-09T16:27:14.115+08:00"},{"id":10694872,"file_name":"r_0.png","project_id":470328,"asset_id":588680,"created_at":"2022-12-09T16:27:14.115+08:00","updated_at":"2022-12-09T16:27:14.115+08:00"},{"id":10694873,"file_name":"r_1.png","project_id":470328,"asset_id":588681,"created_at":"2022-12-09T16:27:14.116+08:00","updated_at":"2022-12-09T16:27:14.116+08:00"},{"id":10694874,"file_name":"b_2.png","project_id":470328,"asset_id":588682,"created_at":"2022-12-09T16:27:14.117+08:00","updated_at":"2022-12-09T16:27:14.117+08:00"},{"id":10694875,"file_name":"b_0.png","project_id":470328,"asset_id":588683,"created_at":"2022-12-09T16:27:14.118+08:00","updated_at":"2022-12-09T16:27:14.118+08:00"},{"id":10694876,"file_name":"b_1.png","project_id":470328,"asset_id":588684,"created_at":"2022-12-09T16:27:14.119+08:00","updated_at":"2022-12-09T16:27:14.119+08:00"},{"id":10694877,"file_name":"b_3.png","project_id":470328,"asset_id":588685,"created_at":"2022-12-09T16:27:14.120+08:00","updated_at":"2022-12-09T16:27:14.120+08:00"},{"id":10694878,"file_name":"hilltop.png","project_id":470328,"asset_id":588686,"created_at":"2022-12-09T16:27:14.121+08:00","updated_at":"2022-12-09T16:27:14.121+08:00"},{"id":10694879,"file_name":"b_5.png","project_id":470328,"asset_id":588687,"created_at":"2022-12-09T16:27:14.122+08:00","updated_at":"2022-12-09T16:27:14.122+08:00"},{"id":10694880,"file_name":"b_4.png","project_id":470328,"asset_id":588688,"created_at":"2022-12-09T16:27:14.122+08:00","updated_at":"2022-12-09T16:27:14.122+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦