{"id":239999,"student_id":10,"content":"let bg = createSprite('bg.png')\nlet info = createSprite(\"info.png\");\nlet player = createSprite(\"p_0.png\", \"p_1.png\", \"p_2.png\", \"p_3.png\");\nlet monster = createSprite(\"monster_0.png\", \"monster_1.png\");\nlet people = createSprite(\"p_0.png\", \"p_3.png\");\nlet speed = 6;\nlet score = 0;\nlet items = [];\nlet active = false;\n\nfor (let i=0; i\u003c6; i++) {\n let item = createSprite(\"rock.png\", \"tree.png\");\n items.push(item);\n item.scale = 0.7;\n}\n\ninital();\n\nlet bgm = createSound('bgm.mp3')\n// bgm.stop();\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() * 2);\n }\n player.x = 600;\n people.y = 1200;\n monster.y = -300;\n player.costumeId = 0;\n score = 0;\n speed = 6;\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 for (let i=0; i\u003citems.length; i++) {\n moveItem(items[i]);\n }\n // speed += 0.001;\n score += speed;\n }\n \n if (key.right || key.left) active = true;\n\n if (key.enter) inital();\n print(score, 0, 0, 'black', 30);\n}\n\nfunction updatePlayer () {\n player.costumeId = 0;\n if (key.right \u0026\u0026 player.x \u003c 1200) {\n player.x += 4;\n player.costumeId = 1;\n }\n if (key.left \u0026\u0026 player.x \u003e 0) {\n player.x -= 4;\n player.costumeId = 2;\n }\n}\n\nfunction updateMonster () {\n monster.y += 2;\n if (monster.y \u003e 900) {\n monster.y -= 1000;\n createSound('show.wav')\n }\n if (monster.x \u003e player.x) {\n monster.x -= 2;\n } else {\n monster.x += 2;\n }\n if (monster.touched(player)) {\n player.costumeId = 3;\n }\n \n if (score % 60 \u003c 30) monster.costumeId = 0;\n else monster.costumeId = 1;\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)) {\n createSound('ouch.wav');\n people.costumeId = 1;\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.scale = 0.7;\n item.costumeId = Math.floor(Math.random() * 2);\n }\n if (player.touched(item)) {\n createSound('ouch.wav');\n player.costumeId = 3;\n }\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-03-30T16:17:56.765+08:00","updated_at":"2021-11-26T18:27:29.260+08:00","name":"滑雪","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/239999/a026e4135c55e57385a221b02319d2f2.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":203,"hashid":"wdks4mdme","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4404361,"file_name":"p_1.png","project_id":239999,"asset_id":333542,"created_at":"2021-03-31T10:29:34.906+08:00","updated_at":"2021-03-31T10:29:34.906+08:00"},{"id":4404362,"file_name":"p_0.png","project_id":239999,"asset_id":333543,"created_at":"2021-03-31T10:29:34.907+08:00","updated_at":"2021-03-31T10:29:34.907+08:00"},{"id":4402771,"file_name":"people.png","project_id":239999,"asset_id":333458,"created_at":"2021-03-30T16:18:25.360+08:00","updated_at":"2021-03-30T16:18:25.360+08:00"},{"id":4404363,"file_name":"p_2.png","project_id":239999,"asset_id":333544,"created_at":"2021-03-31T10:29:35.439+08:00","updated_at":"2021-03-31T10:29:35.439+08:00"},{"id":4404364,"file_name":"p_3.png","project_id":239999,"asset_id":333545,"created_at":"2021-03-31T10:29:35.441+08:00","updated_at":"2021-03-31T10:29:35.441+08:00"},{"id":4402769,"file_name":"player.png","project_id":239999,"asset_id":333456,"created_at":"2021-03-30T16:18:24.845+08:00","updated_at":"2021-03-30T16:18:24.845+08:00"},{"id":4402770,"file_name":"monster.png","project_id":239999,"asset_id":333457,"created_at":"2021-03-30T16:18:24.846+08:00","updated_at":"2021-03-30T16:18:24.846+08:00"},{"id":4404742,"file_name":"show.wav","project_id":239999,"asset_id":333560,"created_at":"2021-03-31T12:14:21.849+08:00","updated_at":"2021-03-31T12:14:21.849+08:00"},{"id":4404695,"file_name":"bg.png","project_id":239999,"asset_id":333555,"created_at":"2021-03-31T11:06:24.919+08:00","updated_at":"2021-03-31T11:06:24.919+08:00"},{"id":4404740,"file_name":"bgm.mp3","project_id":239999,"asset_id":333558,"created_at":"2021-03-31T11:59:23.697+08:00","updated_at":"2021-03-31T11:59:23.697+08:00"},{"id":4404487,"file_name":"tree.png","project_id":239999,"asset_id":333549,"created_at":"2021-03-31T10:50:41.696+08:00","updated_at":"2021-03-31T10:50:41.696+08:00"},{"id":4404488,"file_name":"rock.png","project_id":239999,"asset_id":333550,"created_at":"2021-03-31T10:50:41.698+08:00","updated_at":"2021-03-31T10:50:41.698+08:00"},{"id":4404365,"file_name":"monster_0.png","project_id":239999,"asset_id":333546,"created_at":"2021-03-31T10:36:05.903+08:00","updated_at":"2021-03-31T10:36:05.903+08:00"},{"id":4404366,"file_name":"monster_1.png","project_id":239999,"asset_id":333547,"created_at":"2021-03-31T10:36:05.904+08:00","updated_at":"2021-03-31T10:36:05.904+08:00"},{"id":4404739,"file_name":"info.png","project_id":239999,"asset_id":333557,"created_at":"2021-03-31T11:46:36.505+08:00","updated_at":"2021-03-31T11:46:36.505+08:00"},{"id":4404741,"file_name":"ouch.wav","project_id":239999,"asset_id":333559,"created_at":"2021-03-31T12:09:51.775+08:00","updated_at":"2021-03-31T12:09:51.775+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦