{"id":47787,"student_id":37,"content":"setBackdrop('black');\n\n// 創造天花板\nvar ceiling = createSprite(\"ceiling.png\");\nceiling.x = 320;\nceiling.y = 8;\nceiling.layer = 1;\n\n// 創造左右牆壁\nvar left_wall = createSprite(\"wall.png\");\nvar right_wall = createSprite(\"wall.png\");\nleft_wall.x = 130;\nright_wall.x = 510;\n\n\n\nvar vy = 0;\n\n// 創造玩家\nvar player1 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer1.y = 50;\n\nvar stairs = [];\nfor (var i = 1; i \u003c= 6; i++) {\n var stair = createSprite([\"normal.png\", \"nails.png\", \"trampoline.png\", \"fake.png\", \"conveyor_right.png\", \"conveyor_left.png\"])\n stair.x = 179 + Math.random()*(461-179);\n stair.y = i*80;\n stair.costumeId = Math.floor(Math.random() * 6);\n stairs.push(stair);\n}\n\nplayer1.when('touch', stairs, function(s) {\n\n console.log(s.costumeId);\n\n vy = 0;\n player1.y = s.y - 23;\n if (s.costumeId == 2) {\n vy = -7;\n }\n\n if (s.costumeId == 4) {\n player1.y += 2;\n }\n if (s.costumeId == 5) {\n player1.x -= 2;\n }\n if (s.costumeId == 1 \u0026\u0026 touchOn != s) {\n life -= 3;\n flash = true;\n sound.play(\"flash.mp3\");\n }\n if (s.costumeId == 0 \u0026\u0026 touchOn != s) {\n if (life \u003c 10) {\n life += 1;\n }\n\n }\n if (s.costumeId == 3 \u0026\u0026 s != touchOn) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n\n }\n\n\n touchOn = s;\n\n})\nvar life = 10;\nvar score = 0;\nvar touchOn;\nvar lastTime = 0;\n\nvar best = DB.variables.bestscore || 0;\nvar flash;\nsound.play(\"bg.mp3\");\nforever(function() {\n if (flash == true) {\n setBackdrop(\"blue\");\n } else {\n setBackdrop(\"black\");\n }\n if (flash == true) {\n flash = false;\n }\n\n\n if (key.left \u0026\u0026 !player1.touched(left_wall)) {\n player1.x -= 3;\n }\n if (key.right \u0026\u0026 !player1.touched(right_wall)) {\n player1.x += 3;\n }\n for (var i = 0; i \u003c stairs.length; i++) {\n\n stairs[i].y -= 2;\n if (stairs[i].y \u003c -10) {\n stairs[i].y = 480;\n stairs[i].x = 179 + Math.random()*(461-179);\n stairs[i].costumeId = Math.floor(Math.random() * 6);\n stairs[i].hidden = false;\n score += 1;\n }\n }\n\n var time = Date.now();\n if (player1.touched(ceiling) \u0026\u0026 time - lastTime \u003e 3000) {\n life -= 3;\n lastTime = time;\n vy = 0;\n flash = true;\n\n }\n\n if (life \u003c= 0 || player1.y \u003e 480) {\n setBackdrop(\"gold\");\n stop();\n sound.play(\"gg.mp3\");\n if (score \u003e best) {\n DB.variables.set(\"bestscore\", score);\n\n }\n\n\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n vy += 0.15;\n player2.y += vy;\n\n if (key.left) {\n if (player2.costumeId == 3) {\n player2.costumeId = 4;\n } else {\n player2.costumeId = 3;\n }\n }\n if (key.right) {\n if (player2.costumeId == 1) {\n player2.costumeId = 2;\n } else {\n player2.costumeId = 1;\n }\n }\n if (!key.left \u0026\u0026 !key.right) {}\n\n\n\n\n\n\n\n\n print(\"生命: \"+life, 10, 30, \"white\", 30);\n print(\"分數: \"+score, 10, 70, \"white\", 30);\n print(\"世界紀錄:\", 570, 30, \"white\", 30);\n print(best, 570, 70, \"white\", 30);\n})\n\n\n\n\nvar player2 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer2.y = 50;\n\n\nplayer2.when('touch', stairs, function(s) {\n vy = 0;\n player2.y = s.y - 23;\n if (s.costumeId == 2) {\n vy = -7;\n }\n\n if (s.costumeId == 4) {\n player2.y += 2;\n }\n if (s.costumeId == 5) {\n player2.x -= 2;\n }\n if (s.costumeId == 1 \u0026\u0026 touchOn != s) {\n life -= 3;\n flash = true;\n sound.play(\"flash.mp3\");\n }\n if (s.costumeId == 0 \u0026\u0026 touchOn != s) {\n if (life \u003c 10) {\n life += 1;\n }\n\n }\n if (s.costumeId == 3 \u0026\u0026 s != touchOn) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n\n }\n});\nsound.play(\"bg.mp3\");\nforever(function() {\n if (flash == true) {\n setBackdrop(\"blue\");\n } else {\n setBackdrop(\"black\");\n }\n if (flash == true) {\n flash = false;\n }\n\n\n if (key.left \u0026\u0026 !player2.touched(left_wall)) {\n player2.x -= 3;\n }\n if (key.right \u0026\u0026 !player2.touched(right_wall)) {\n player2.x += 3;\n }\n for (var i = 0; i \u003c stairs.length; i++) {\n\n stairs[i].y -= 2;\n if (stairs[i].y \u003c -10) {\n stairs[i].y = 480;\n stairs[i].x = 179 + Math.random()*(461-179);\n stairs[i].costumeId = Math.floor(Math.random() * 6);\n stairs[i].hidden = false;\n score += 1;\n }\n }\n\n var time = Date.now();\n if (player2.touched(ceiling) \u0026\u0026 time - lastTime \u003e 3000) {\n life -= 3;\n lastTime = time;\n vy = 0;\n flash = true;\n\n }\n\n if (life \u003c= 0 || player2.y \u003e 480) {\n setBackdrop(\"gold\");\n stop();\n sound.play2(\"gg.mp3\");\n if (score \u003e best) {\n DB.variables.set(\"bestscore\", score);\n\n }\n\n\n\n\n\n }\n});","created_at":"2018-11-04T09:52:44.474+08:00","updated_at":"2019-10-12T21:58:56.458+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/47787/6e0a747d0622e444b4672d9a9095f095.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":69,"hashid":"5j3svj5p","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":855652,"file_name":"jump.mp3","project_id":47787,"asset_id":36478,"created_at":"2018-11-04T09:52:44.493+08:00","updated_at":"2018-11-04T09:52:44.493+08:00"},{"id":855653,"file_name":"gg.mp3","project_id":47787,"asset_id":36479,"created_at":"2018-11-04T09:52:44.499+08:00","updated_at":"2018-11-04T09:52:44.499+08:00"},{"id":855654,"file_name":"flash.mp3","project_id":47787,"asset_id":36476,"created_at":"2018-11-04T09:52:44.502+08:00","updated_at":"2018-11-04T09:52:44.502+08:00"},{"id":855655,"file_name":"bg.mp3","project_id":47787,"asset_id":36477,"created_at":"2018-11-04T09:52:44.506+08:00","updated_at":"2018-11-04T09:52:44.506+08:00"},{"id":855656,"file_name":"conveyor_left.png","project_id":47787,"asset_id":33485,"created_at":"2018-11-04T09:52:44.509+08:00","updated_at":"2018-11-04T09:52:44.509+08:00"},{"id":855657,"file_name":"conveyor_right.png","project_id":47787,"asset_id":33486,"created_at":"2018-11-04T09:52:44.512+08:00","updated_at":"2018-11-04T09:52:44.512+08:00"},{"id":855658,"file_name":"fake.png","project_id":47787,"asset_id":33487,"created_at":"2018-11-04T09:52:44.516+08:00","updated_at":"2018-11-04T09:52:44.516+08:00"},{"id":855659,"file_name":"normal.png","project_id":47787,"asset_id":33488,"created_at":"2018-11-04T09:52:44.519+08:00","updated_at":"2018-11-04T09:52:44.519+08:00"},{"id":855660,"file_name":"trampoline.png","project_id":47787,"asset_id":33489,"created_at":"2018-11-04T09:52:44.521+08:00","updated_at":"2018-11-04T09:52:44.521+08:00"},{"id":855661,"file_name":"nails.png","project_id":47787,"asset_id":33490,"created_at":"2018-11-04T09:52:44.524+08:00","updated_at":"2018-11-04T09:52:44.524+08:00"},{"id":855662,"file_name":"ceiling.png","project_id":47787,"asset_id":33491,"created_at":"2018-11-04T09:52:44.526+08:00","updated_at":"2018-11-04T09:52:44.526+08:00"},{"id":855663,"file_name":"wall.png","project_id":47787,"asset_id":33492,"created_at":"2018-11-04T09:52:44.528+08:00","updated_at":"2018-11-04T09:52:44.528+08:00"},{"id":855664,"file_name":"player_3.png","project_id":47787,"asset_id":33493,"created_at":"2018-11-04T09:52:44.531+08:00","updated_at":"2018-11-04T09:52:44.531+08:00"},{"id":855665,"file_name":"player_4.png","project_id":47787,"asset_id":33494,"created_at":"2018-11-04T09:52:44.533+08:00","updated_at":"2018-11-04T09:52:44.533+08:00"},{"id":855666,"file_name":"player_2.png","project_id":47787,"asset_id":33495,"created_at":"2018-11-04T09:52:44.535+08:00","updated_at":"2018-11-04T09:52:44.535+08:00"},{"id":855667,"file_name":"player_5.png","project_id":47787,"asset_id":33496,"created_at":"2018-11-04T09:52:44.537+08:00","updated_at":"2018-11-04T09:52:44.537+08:00"},{"id":855668,"file_name":"player_1.png","project_id":47787,"asset_id":33497,"created_at":"2018-11-04T09:52:44.539+08:00","updated_at":"2018-11-04T09:52:44.539+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦