{"id":226496,"student_id":10,"content":"let bg = createSprite('bg.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', 'monster_2.png', 'monster_3.png');\nlet blocks = [];\nlet vy = 0;\nlet score = 0;\nlet space = 50;\nlet power = 0;\nlet disable = false;\n\nplayer.layer = 1;\nmonster.y = -1000;\n\nfor (let i = 0; i \u003c 18; i++) {\n let b = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png');\n b.y = i*space;\n b.x = Math.random()*1000 + 100;\n b.costumeId = Math.floor(Math.random() * 4);\n blocks.push(b);\n}\n\nfunction gameloop () {\n blocks.forEach(updateBlocks);\n updateBackground();\n updatePlayer();\n updateScores();\n updateMonster();\n}\n\nfunction updateBackground () {\n if (player.y \u003c 450 \u0026\u0026 vy \u003e 0) {\n bg.y += vy;\n }\n if (bg.y \u003e 900) bg.y -= 1800;\n}\n\nfunction updatePlayer () {\n if (player.y \u003e 450 || vy \u003c 0) {\n player.y -= vy;\n }\n vy -= 0.4;\n\n if (key.right) player.x += 10;\n if (key.left) player.x -= 10;\n if (player.x \u003c 0) player.x += 1200;\n if (player.x \u003e 1200) player.x -= 1200;\n if (player.y \u003e 2000) gameover();\n \n if (power \u003e 0) {\n power -= 1;\n if (player.costumeId == 1) vy = 10;\n if (player.costumeId == 2) vy = 30;\n }\n if (vy \u003c= 0) {\n player.costumeId = 0;\n }\n}\n\nfunction updateBlocks (b) {\n if (player.y \u003c 450 \u0026\u0026 vy \u003e 0) {\n b.y += vy;\n }\n\n if (b.y \u003e 900) {\n b.y -= space * 18;\n b.x = Math.random()*1000 + 100;\n b.direction = 90;\n b.hidden = false;\n \n let rand = Math.random();\n if (rand \u003c 0.6) b.costumeId = 0;\n else if (rand \u003c 0.8) b.costumeId = 1;\n else if (rand \u003c 0.9) b.costumeId = 2;\n else if (rand \u003c 0.95) b.costumeId = 3;\n else b.costumeId = 4;\n }\n\n if (b.costumeId == 2) {\n b.stepForward(3);\n if (b.x \u003c 100 || b.x \u003e 1100) b.direction += 180;\n }\n\n if (b.touched(player) \u0026\u0026 vy \u003c 0 \u0026\u0026 player.y \u003c b.y \u0026\u0026 disable == false) {\n vy = 15\n if (b.costumeId == 1) { //樹叢\n vy = 25;\n } \n if (b.costumeId == 3) { //雲躲\n b.hidden = true;\n }\n if (b.costumeId == 4) {\n power = 100; // 內褲超人\n b.hidden = true;\n player.costumeId = 1;\n }\n if (b.costumeId == 4) {\n power = 100; // 內褲超人\n b.hidden = true;\n player.costumeId = 2;\n }\n b.scale = 1.4;\n }\n \n if (b.scale \u003e 1) b.scale -= 0.05;\n}\n\nfunction updateMonster () {\n if (player.y \u003c 450 \u0026\u0026 vy \u003e 0) {\n monster.y += vy;\n }\n \n monster.rotationStyle = 'flipped';\n monster.stepForward(3);\n if (monster.x \u003c 100 || monster.x \u003e 1100) {\n monster.direction += 180;\n }\n \n if (monster.y \u003e 900) {\n monster.y -= 3000;\n monster.costumeId = Math.floor(Math.random() * 4);\n }\n if (monster.touched(player) \u0026\u0026 vy \u003c 10) {\n disable = true;\n player.scale = 1.2;\n }\n}\n\nfunction updateScores() {\n space = 50 * (1 + score / 10000);\n if (player.y \u003c 450 \u0026\u0026 vy \u003e 0) score += vy;\n drawText(Math.floor(score), 10, 10, 'black', 30);\n}\n\nfunction gameover () {\n createSprite('result.png');\n drawText(Math.floor(score), 500, 520, 'black', 60);\n stop();\n}\n\nforever(gameloop);\n","created_at":"2021-02-03T12:36:34.836+08:00","updated_at":"2021-05-04T10:37:06.743+08:00","name":"叩叮 Jump","language":"javascript","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/226496/e4d6af38c572567bd55bc3fd06b4bdb0.jpg"},"parent_id":226495,"plugin":"Game.set({ width: 1200, height: 900 });","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":233,"hashid":"d5msvn3zk","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4698662,"file_name":"bg.png","project_id":226496,"asset_id":348790,"created_at":"2021-05-04T10:20:44.820+08:00","updated_at":"2021-05-04T10:20:44.820+08:00"},{"id":4698663,"file_name":"gameover.png","project_id":226496,"asset_id":348791,"created_at":"2021-05-04T10:20:44.822+08:00","updated_at":"2021-05-04T10:20:44.822+08:00"},{"id":4698666,"file_name":"item_2.png","project_id":226496,"asset_id":348794,"created_at":"2021-05-04T10:20:45.597+08:00","updated_at":"2021-05-04T10:20:45.597+08:00"},{"id":4698667,"file_name":"monster_0.png","project_id":226496,"asset_id":348795,"created_at":"2021-05-04T10:20:45.599+08:00","updated_at":"2021-05-04T10:20:45.599+08:00"},{"id":4698664,"file_name":"item_0.png","project_id":226496,"asset_id":348792,"created_at":"2021-05-04T10:20:45.187+08:00","updated_at":"2021-05-04T10:20:45.187+08:00"},{"id":4698665,"file_name":"item_1.png","project_id":226496,"asset_id":348793,"created_at":"2021-05-04T10:20:45.188+08:00","updated_at":"2021-05-04T10:20:45.188+08:00"},{"id":4698670,"file_name":"p_0.png","project_id":226496,"asset_id":348798,"created_at":"2021-05-04T10:20:47.078+08:00","updated_at":"2021-05-04T10:20:47.078+08:00"},{"id":4698671,"file_name":"p_1.png","project_id":226496,"asset_id":348799,"created_at":"2021-05-04T10:20:47.080+08:00","updated_at":"2021-05-04T10:20:47.080+08:00"},{"id":4698668,"file_name":"monster_1.png","project_id":226496,"asset_id":348796,"created_at":"2021-05-04T10:20:46.657+08:00","updated_at":"2021-05-04T10:20:46.657+08:00"},{"id":4698669,"file_name":"monster_2.png","project_id":226496,"asset_id":348797,"created_at":"2021-05-04T10:20:46.659+08:00","updated_at":"2021-05-04T10:20:46.659+08:00"},{"id":4698672,"file_name":"p_2.png","project_id":226496,"asset_id":348800,"created_at":"2021-05-04T10:20:47.427+08:00","updated_at":"2021-05-04T10:20:47.427+08:00"},{"id":4698673,"file_name":"p_3.png","project_id":226496,"asset_id":348801,"created_at":"2021-05-04T10:20:47.429+08:00","updated_at":"2021-05-04T10:20:47.429+08:00"},{"id":4698658,"file_name":"b_0.png","project_id":226496,"asset_id":348786,"created_at":"2021-05-04T10:20:43.522+08:00","updated_at":"2021-05-04T10:20:43.522+08:00"},{"id":4698659,"file_name":"b_1.png","project_id":226496,"asset_id":348787,"created_at":"2021-05-04T10:20:43.524+08:00","updated_at":"2021-05-04T10:20:43.524+08:00"},{"id":4698660,"file_name":"b_2.png","project_id":226496,"asset_id":348788,"created_at":"2021-05-04T10:20:43.873+08:00","updated_at":"2021-05-04T10:20:43.873+08:00"},{"id":4698661,"file_name":"b_3.png","project_id":226496,"asset_id":348789,"created_at":"2021-05-04T10:20:43.875+08:00","updated_at":"2021-05-04T10:20:43.875+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦