{"id":354049,"student_id":10,"content":"let images = ['o_0.png', 'o_1.png', 'o_2.png', 't_3.png', 't_4.png', 't_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 info = createSprite('info.png'); //山屋背景\nlet n1 = createSprite(numberImgs); //分數個位數\nlet n2 = createSprite(numberImgs); //分數十位數\nlet n3 = createSprite(numberImgs); //分數百位數\nlet b1 = createSprite(images); //障礙物1\nlet b2 = createSprite(images); //障礙物2\nlet b3 = createSprite(images); //障礙物3\nlet b4 = createSprite(images); //障礙物4\nlet monster = createSprite('m_0.png', 'm_1.png', 'm_2.png'); //雪怪\nlet people = createSprite('y_0.png', 'y_1.png'); //觀光客叩叮\nlet player = createSprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png'); //玩家\nlet enterBtn = createSprite('enter_btn.png'); // 重新開始提示按鍵\n\nlet speed = 6; // 速度\nlet score = 0; // 分數\nlet isStart = false; // 是否開始\n\ninit(); // 初始化\n\nn1.moveTo(50, 50);\nn2.moveTo(100, 50);\nn3.moveTo(150, 50);\nenterBtn.y = 700;\n\n// 重置所有角色位置\nfunction init () {\n info.y = 450;\n bg.y = 1800;\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 people.y = 1200;\n score = 0;\n speed = 5;\n enterBtn.hidden = true;\n isStart = false;\n player.costumeId = 0;\n people.costumeId = 0;\n}\n\n\n// 遊戲主迴圈\nfunction gameloop () {\n if (isStart \u0026\u0026 enterBtn.hidden) {\n updatePlayer();\n updateMonster();\n updateGround();\n updateBlock(b1);\n updateBlock(b2);\n updateBlock(b3);\n updateBlock(b4);\n updatePeople();\n updateNumbers();\n if (speed \u003c 10) {\n speed += 0.001;\n }\n }\n\n if (key.right || key.left) {\n isStart = true;\n }\n\n if (key.enter \u0026\u0026 enterBtn.hidden == false) {\n init();\n }\n}\n\n// 更新背景圖\nfunction updateGround () {\n bg.y -= speed;\n info.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 0) {\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 player.costumeId = 0;\n if (key.right \u0026\u0026 player.x \u003c 1200) {\n player.x += speed * 1.5;\n player.costumeId = 1;\n }\n if (key.left \u0026\u0026 player.x \u003e 0) {\n player.x -= speed * 1.5;\n player.costumeId = 2;\n }\n}\n\n// 更新雪怪\nfunction updateMonster () {\n\n monster.y += speed / 2;\n if (monster.y \u003e 1000) {\n monster.y -= 1800;\n }\n\n if (monster.x \u003e player.x) {\n monster.x -= speed / 6;\n } else {\n monster.x += speed / 6;\n }\n \n if (monster.y % 100 \u003e 50) {\n monster.costumeId = 0;\n } else {\n monster.costumeId = 1;\n }\n\n if (monster.touched(player) \u0026\u0026 monster.y \u003c player.y) {\n gameover();\n }\n}\n\n// 更新黃色叩叮\nfunction updatePeople () {\n\n // people.y -= speed / 2;\n if (people.costumeId == 0) {\n people.y -= speed / 2;\n } else {\n people.y -= speed;\n }\n\n if (people.y \u003c -100) {\n people.y += 1300;\n people.x = Math.random() * 1000 + 100;\n people.costumeId = 0;\n }\n\n if (people.touched(player) \u0026\u0026 people.costumeId == 0) {\n people.costumeId = 1;\n score += 10;\n }\n}\n\n// 更新分數\nfunction updateNumbers () {\n score += 0.01;\n let s = Math.floor(score);\n n1.costumeId = Math.floor(s / 100);\n n2.costumeId = Math.floor(s / 10) % 10;\n n3.costumeId = s % 10;\n}\n\n// 遊戲結束\nfunction gameover () {\n player.costumeId = 3; // 玩家跌倒\n monster.costumeId = 2; // 雪怪嘲笑\n enterBtn.hidden = false; // 顯示重新開始提示\n}\n\nforever(gameloop)","created_at":"2022-03-07T10:14:20.177+08:00","updated_at":"2022-03-10T08:56:51.633+08:00","name":"滑雪_完整","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/354049/b230fa3bcc0fafe3f75ee57f07ce202f.jpg"},"parent_id":249765,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":146,"hashid":"wdks4rmrg","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":7711387,"file_name":"2.png","project_id":354049,"asset_id":348722,"created_at":"2022-03-07T10:14:20.205+08:00","updated_at":"2022-03-07T10:14:20.205+08:00"},{"id":7711388,"file_name":"3.png","project_id":354049,"asset_id":348723,"created_at":"2022-03-07T10:14:20.206+08:00","updated_at":"2022-03-07T10:14:20.206+08:00"},{"id":7711389,"file_name":"4.png","project_id":354049,"asset_id":348724,"created_at":"2022-03-07T10:14:20.207+08:00","updated_at":"2022-03-07T10:14:20.207+08:00"},{"id":7711390,"file_name":"5.png","project_id":354049,"asset_id":348725,"created_at":"2022-03-07T10:14:20.208+08:00","updated_at":"2022-03-07T10:14:20.208+08:00"},{"id":7711391,"file_name":"8.png","project_id":354049,"asset_id":348728,"created_at":"2022-03-07T10:14:20.209+08:00","updated_at":"2022-03-07T10:14:20.209+08:00"},{"id":7711392,"file_name":"9.png","project_id":354049,"asset_id":348729,"created_at":"2022-03-07T10:14:20.210+08:00","updated_at":"2022-03-07T10:14:20.210+08:00"},{"id":7711393,"file_name":"6.png","project_id":354049,"asset_id":348726,"created_at":"2022-03-07T10:14:20.211+08:00","updated_at":"2022-03-07T10:14:20.211+08:00"},{"id":7711394,"file_name":"7.png","project_id":354049,"asset_id":348727,"created_at":"2022-03-07T10:14:20.212+08:00","updated_at":"2022-03-07T10:14:20.212+08:00"},{"id":7711446,"file_name":"y_0.png","project_id":354049,"asset_id":348740,"created_at":"2022-03-07T13:37:42.503+08:00","updated_at":"2022-03-07T13:37:42.503+08:00"},{"id":7711369,"file_name":"show.wav","project_id":354049,"asset_id":333560,"created_at":"2022-03-07T10:14:20.184+08:00","updated_at":"2022-03-07T10:14:20.184+08:00"},{"id":7711370,"file_name":"ouch.wav","project_id":354049,"asset_id":333559,"created_at":"2022-03-07T10:14:20.186+08:00","updated_at":"2022-03-07T10:14:20.186+08:00"},{"id":7711371,"file_name":"bgm.mp3","project_id":354049,"asset_id":333558,"created_at":"2022-03-07T10:14:20.187+08:00","updated_at":"2022-03-07T10:14:20.187+08:00"},{"id":7711372,"file_name":"bg.png","project_id":354049,"asset_id":348730,"created_at":"2022-03-07T10:14:20.188+08:00","updated_at":"2022-03-07T10:14:20.188+08:00"},{"id":7711373,"file_name":"enter_btn.png","project_id":354049,"asset_id":348731,"created_at":"2022-03-07T10:14:20.190+08:00","updated_at":"2022-03-07T10:14:20.190+08:00"},{"id":7711374,"file_name":"0.png","project_id":354049,"asset_id":348720,"created_at":"2022-03-07T10:14:20.191+08:00","updated_at":"2022-03-07T10:14:20.191+08:00"},{"id":7711375,"file_name":"1.png","project_id":354049,"asset_id":348721,"created_at":"2022-03-07T10:14:20.192+08:00","updated_at":"2022-03-07T10:14:20.192+08:00"},{"id":7711377,"file_name":"m_0.png","project_id":354049,"asset_id":348733,"created_at":"2022-03-07T10:14:20.195+08:00","updated_at":"2022-03-07T11:09:26.459+08:00"},{"id":7711378,"file_name":"p_0.png","project_id":354049,"asset_id":435232,"created_at":"2022-03-07T10:14:20.196+08:00","updated_at":"2022-03-07T13:39:44.848+08:00"},{"id":7711379,"file_name":"p_1.png","project_id":354049,"asset_id":435233,"created_at":"2022-03-07T10:14:20.197+08:00","updated_at":"2022-03-07T10:14:20.197+08:00"},{"id":7711381,"file_name":"o_2.png","project_id":354049,"asset_id":348743,"created_at":"2022-03-07T10:14:20.199+08:00","updated_at":"2022-03-07T13:38:48.444+08:00"},{"id":7711382,"file_name":"t_5.png","project_id":354049,"asset_id":348746,"created_at":"2022-03-07T10:14:20.200+08:00","updated_at":"2022-03-07T11:09:01.591+08:00"},{"id":7711383,"file_name":"p_2.png","project_id":354049,"asset_id":435234,"created_at":"2022-03-07T10:14:20.201+08:00","updated_at":"2022-03-07T10:14:20.201+08:00"},{"id":7711384,"file_name":"p_3.png","project_id":354049,"asset_id":435235,"created_at":"2022-03-07T10:14:20.202+08:00","updated_at":"2022-03-07T10:14:20.202+08:00"},{"id":7711449,"file_name":"info.png","project_id":354049,"asset_id":483959,"created_at":"2022-03-07T13:42:59.650+08:00","updated_at":"2022-03-07T13:42:59.650+08:00"},{"id":7711380,"file_name":"o_1.png","project_id":354049,"asset_id":348742,"created_at":"2022-03-07T10:14:20.198+08:00","updated_at":"2022-03-07T13:38:45.096+08:00"},{"id":7711447,"file_name":"y_1.png","project_id":354049,"asset_id":483957,"created_at":"2022-03-07T13:37:43.312+08:00","updated_at":"2022-03-07T13:37:43.312+08:00"},{"id":7711386,"file_name":"o_0.png","project_id":354049,"asset_id":348741,"created_at":"2022-03-07T10:14:20.204+08:00","updated_at":"2022-03-07T13:38:36.642+08:00"},{"id":7711395,"file_name":"m_1.png","project_id":354049,"asset_id":348734,"created_at":"2022-03-07T10:14:20.213+08:00","updated_at":"2022-03-07T11:09:23.276+08:00"},{"id":7711396,"file_name":"m_2.png","project_id":354049,"asset_id":348735,"created_at":"2022-03-07T10:14:20.214+08:00","updated_at":"2022-03-07T11:09:30.826+08:00"},{"id":7711397,"file_name":"t_3.png","project_id":354049,"asset_id":348745,"created_at":"2022-03-07T10:14:20.215+08:00","updated_at":"2022-03-07T11:08:49.903+08:00"},{"id":7711398,"file_name":"t_4.png","project_id":354049,"asset_id":348744,"created_at":"2022-03-07T10:14:20.216+08:00","updated_at":"2022-03-07T11:08:53.742+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦