{"id":249765,"student_id":10,"content":"let bg = createSprite('bg.png')\nlet info = createSprite(\"info.png\");\nlet people = createSprite(\"people.png\", \"p_3.png\");\nlet monster = createSprite(\"monster_0.png\", \"monster_1.png\", \"monster_2.png\");\nlet player = createSprite(\"p_0.png\", \"p_1.png\", \"p_2.png\", \"p_3.png\");\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 enterBtn = createSprite('enter_btn.png');\nlet speed = 6;\nlet score = 0;\nlet items = [];\nlet active = false;\n\nn1.moveTo(50, 50);\nn2.moveTo(100, 50);\nn3.moveTo(150, 50);\nenterBtn.hidden = true;\nenterBtn.y = 700;\n\nfor (let i=0; i\u003c6; i++) {\n let item = createSprite(\"rock_0.png\", \"rock_1.png\", \"rock_2.png\", \"tree_3.png\", \"tree_4.png\", \"tree_2.png\");\n items.push(item);\n // item.scale = 2;\n item.layer = -1;\n}\n\nbg.layer = -2;\n\ninital();\n\nlet bgm = createSound('bgm.mp3', true);\n\nfunction inital () {\n for (let i=0; i\u003citems.length; i++) {\n items[i].y = 1000 + 200*i;\n items[i].x = Math.random() * 1200;\n items[i].costumeId = Math.floor(Math.random() * 6);\n }\n player.x = 600;\n people.y = 1200;\n monster.y = -300;\n monster.costumeId = 0;\n player.costumeId = 0;\n score = 0;\n speed = 8;\n info.y = 450;\n active = false;\n}\n\nfunction gameloop () {\n if (player.costumeId != 3 \u0026\u0026 active == true) {\n updatePlayer();\n updateMonster();\n updatePeople();\n updateGround();\n updateNumbers();\n for (let i=0; i\u003citems.length; i++) {\n moveItem(items[i]);\n }\n score += 0.1;\n }\n \n if (key.right || key.left) {\n active = true;\n enterBtn.hidden = true;\n }\n\n if (key.enter) inital();\n}\n\nfunction updatePlayer () {\n player.costumeId = 0;\n if (key.right \u0026\u0026 player.x \u003c 1200) {\n player.x += 6;\n player.costumeId = 1;\n }\n if (key.left \u0026\u0026 player.x \u003e 0) {\n player.x -= 6;\n player.costumeId = 2;\n }\n}\n\nfunction updateMonster () {\n monster.y += 2;\n if (monster.y \u003e 2000) {\n monster.y -= 2100;\n createSound('show.wav');\n }\n if (monster.x \u003e player.x) {\n monster.x -= 1\n } else {\n monster.x += 1;\n }\n \n if (score % 4 \u003c 2) monster.costumeId = 0;\n else monster.costumeId = 1;\n \n if (monster.touched(player) \u0026\u0026 Math.abs(player.x - monster.x) \u003c 50) {\n player.costumeId = 3;\n monster.costumeId = 2;\n createSound('ouch.wav');\n }\n}\n\nfunction updatePeople () {\n if (people.costumeId == 0) {\n people.y -= 2;\n } else {\n people.y -= 6;\n }\n \n if (people.y \u003c 0) {\n // people.y += 900 + Math.random() * 300;\n people.x = Math.random() * 1200;\n people.costumeId = 0;\n }\n if (people.touched(player) \u0026\u0026 people.costumeId == 0 \u0026\u0026 Math.abs(player.x - people.x) \u003c 50) {\n createSound('ouch.wav');\n people.costumeId = 1;\n enterBtn.hidden = false;\n }\n}\n\nfunction moveItem (item) {\n item.y -= speed;\n if (item.y \u003c 0) {\n item.y += 1050 + Math.random() * 300;\n item.x = Math.random() * 1200;\n item.costumeId = Math.floor(Math.random() * 6);\n }\n if (player.distanceTo(item) \u003c 30) {\n createSound('ouch.wav');\n player.costumeId = 3;\n enterBtn.hidden = false;\n }\n}\n\nfunction updateNumbers () {\n let s = parseInt(score)\n n1.costumeId = Math.floor(s / 100);\n n2.costumeId = Math.floor(s / 10) % 10;\n n3.costumeId = s % 10;\n}\n\nfunction updateGround () {\n bg.y -= speed;\n if (bg.y \u003c 0) bg.y += 900;\n info.y -= speed;\n}\n\nforever(gameloop);","created_at":"2021-05-03T18:45:44.599+08:00","updated_at":"2022-03-07T10:20:26.051+08:00","name":"滑雪","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/249765/0814f9bffea1670ca6dc010231d2c2e0.jpg"},"parent_id":239999,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":181,"hashid":"zpesj3m56","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4696380,"file_name":"show.wav","project_id":249765,"asset_id":333560,"created_at":"2021-05-03T18:45:44.605+08:00","updated_at":"2021-05-03T18:45:44.605+08:00"},{"id":4696381,"file_name":"ouch.wav","project_id":249765,"asset_id":333559,"created_at":"2021-05-03T18:45:44.607+08:00","updated_at":"2021-05-03T18:45:44.607+08:00"},{"id":4696382,"file_name":"bgm.mp3","project_id":249765,"asset_id":333558,"created_at":"2021-05-03T18:45:44.608+08:00","updated_at":"2021-05-03T18:45:44.608+08:00"},{"id":6431144,"file_name":"bg.png","project_id":249765,"asset_id":348730,"created_at":"2021-11-11T11:48:50.907+08:00","updated_at":"2021-11-11T11:48:50.907+08:00"},{"id":6431145,"file_name":"enter_btn.png","project_id":249765,"asset_id":348731,"created_at":"2021-11-11T11:48:50.909+08:00","updated_at":"2021-11-11T11:48:50.909+08:00"},{"id":6431134,"file_name":"0.png","project_id":249765,"asset_id":348720,"created_at":"2021-11-11T11:48:47.964+08:00","updated_at":"2021-11-11T11:48:47.964+08:00"},{"id":6431135,"file_name":"1.png","project_id":249765,"asset_id":348721,"created_at":"2021-11-11T11:48:47.966+08:00","updated_at":"2021-11-11T11:48:47.966+08:00"},{"id":6431146,"file_name":"info.png","project_id":249765,"asset_id":348732,"created_at":"2021-11-11T11:48:51.733+08:00","updated_at":"2021-11-11T11:48:51.733+08:00"},{"id":6431147,"file_name":"monster_0.png","project_id":249765,"asset_id":348733,"created_at":"2021-11-11T11:48:51.734+08:00","updated_at":"2021-11-11T11:48:51.734+08:00"},{"id":6431150,"file_name":"p_0.png","project_id":249765,"asset_id":435232,"created_at":"2021-11-11T11:48:52.822+08:00","updated_at":"2021-11-11T11:48:52.822+08:00"},{"id":6431151,"file_name":"p_1.png","project_id":249765,"asset_id":435233,"created_at":"2021-11-11T11:48:52.823+08:00","updated_at":"2021-11-11T11:48:52.823+08:00"},{"id":6431156,"file_name":"rock_1.png","project_id":249765,"asset_id":348742,"created_at":"2021-11-11T11:48:54.439+08:00","updated_at":"2021-11-11T11:48:54.439+08:00"},{"id":6431157,"file_name":"rock_2.png","project_id":249765,"asset_id":348743,"created_at":"2021-11-11T11:48:54.441+08:00","updated_at":"2021-11-11T11:48:54.441+08:00"},{"id":6431160,"file_name":"tree_2.png","project_id":249765,"asset_id":348746,"created_at":"2021-11-11T11:48:55.479+08:00","updated_at":"2021-11-11T11:48:55.479+08:00"},{"id":6431152,"file_name":"p_2.png","project_id":249765,"asset_id":435234,"created_at":"2021-11-11T11:48:53.362+08:00","updated_at":"2021-11-11T11:48:53.362+08:00"},{"id":6431153,"file_name":"p_3.png","project_id":249765,"asset_id":435235,"created_at":"2021-11-11T11:48:53.364+08:00","updated_at":"2021-11-11T11:48:53.364+08:00"},{"id":6431154,"file_name":"people.png","project_id":249765,"asset_id":348740,"created_at":"2021-11-11T11:48:53.897+08:00","updated_at":"2021-11-11T11:48:53.897+08:00"},{"id":6431155,"file_name":"rock_0.png","project_id":249765,"asset_id":348741,"created_at":"2021-11-11T11:48:53.899+08:00","updated_at":"2021-11-11T11:48:53.899+08:00"},{"id":6431136,"file_name":"2.png","project_id":249765,"asset_id":348722,"created_at":"2021-11-11T11:48:48.487+08:00","updated_at":"2021-11-11T11:48:48.487+08:00"},{"id":6431137,"file_name":"3.png","project_id":249765,"asset_id":348723,"created_at":"2021-11-11T11:48:48.489+08:00","updated_at":"2021-11-11T11:48:48.489+08:00"},{"id":6431138,"file_name":"4.png","project_id":249765,"asset_id":348724,"created_at":"2021-11-11T11:48:49.045+08:00","updated_at":"2021-11-11T11:48:49.045+08:00"},{"id":6431139,"file_name":"5.png","project_id":249765,"asset_id":348725,"created_at":"2021-11-11T11:48:49.047+08:00","updated_at":"2021-11-11T11:48:49.047+08:00"},{"id":6431142,"file_name":"8.png","project_id":249765,"asset_id":348728,"created_at":"2021-11-11T11:48:50.140+08:00","updated_at":"2021-11-11T11:48:50.140+08:00"},{"id":6431143,"file_name":"9.png","project_id":249765,"asset_id":348729,"created_at":"2021-11-11T11:48:50.142+08:00","updated_at":"2021-11-11T11:48:50.142+08:00"},{"id":6431140,"file_name":"6.png","project_id":249765,"asset_id":348726,"created_at":"2021-11-11T11:48:49.573+08:00","updated_at":"2021-11-11T11:48:49.573+08:00"},{"id":6431141,"file_name":"7.png","project_id":249765,"asset_id":348727,"created_at":"2021-11-11T11:48:49.574+08:00","updated_at":"2021-11-11T11:48:49.574+08:00"},{"id":6431148,"file_name":"monster_1.png","project_id":249765,"asset_id":348734,"created_at":"2021-11-11T11:48:52.279+08:00","updated_at":"2021-11-11T11:48:52.279+08:00"},{"id":6431149,"file_name":"monster_2.png","project_id":249765,"asset_id":348735,"created_at":"2021-11-11T11:48:52.280+08:00","updated_at":"2021-11-11T11:48:52.280+08:00"},{"id":6431159,"file_name":"tree_3.png","project_id":249765,"asset_id":348745,"created_at":"2021-11-11T11:48:54.986+08:00","updated_at":"2021-11-11T11:50:35.195+08:00"},{"id":6431158,"file_name":"tree_4.png","project_id":249765,"asset_id":348744,"created_at":"2021-11-11T11:48:54.984+08:00","updated_at":"2021-11-11T11:50:37.952+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦