{"id":71266,"student_id":1874,"content":"setBackdrop('black');\nvar vy = 0;\nvar life = 10;\nvar p2life = 10;\nvar touchOn;\nvar score = 0;\nvar lasttime = Date.now();\nvar best=DB.variables.bestscore||0;\nvar flash=false;\nvar p2flash=false;\nvar touchOn1;\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// 創造玩家\nvar player = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer.y = 50;\nvar p2=createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\np2.y=50;\nvar stairs = [];\nfor (var i = 0; i \u003c 8; i++) {\n var stair = createSprite(['nails.png', 'trampoline.png', 'normal.png', 'fake.png', 'conveyor_right.png', 'conveyor_left.png']);\n stair.x = Math.random()*280+180;\n stair.y = 80*i + 400;\n stair.costumeId = Math.floor(Math.random()*6);\n stairs.push(stair);\n}\nsound.play('bg.mp3');\nforever(function() {\n setBackdrop('black');\n if (flash===true) {\n setBackdrop('red');\n sound.play('flash.mp3');\n flash=false;\n }\n if (p2flash===true) {\n setBackdrop('blue');\n sound.play('flash.mp3');\n p2flash=false;\n }\n vy += 0.15;\n player.y += vy;\n if (player.touched(right_wall) === false \u0026\u0026 key.right) {\n player.x += 3;\n } \n if (player.touched(left_wall) === false \u0026\u0026 key.left) {\n player.x -= 3;\n }\n p2.y += vy;\n if (p2.touched(right_wall) === false \u0026\u0026 key.d) {\n p2.x += 3;\n } \n if (p2.touched(left_wall) === false \u0026\u0026 key.a) {\n p2.x -= 3;\n }\n for (var i = 0; i \u003c stairs.length; i++) {\n stairs[i].y -= 2;\n if (stairs[i].y \u003c 0) {\n stairs[i].y = 640;\n stairs[i].x = Math.random()*280+180;\n stairs[i].costumeId = Math.floor(Math.random()*6);\n stairs[i].hidden = false;\n score+=1;\n }\n }\n print('p1生命:'+life, 10, 10, 'white', 20);\n print('p2生命:'+p2life, 530, 10, 'white', 20);\n if (player.touched(ceiling) \u0026\u0026 Date.now()-lasttime \u003e 3000) {\n life -= 3;\n flash=true;\n lasttime = Date.now();\n }\n if (p2.touched(ceiling) \u0026\u0026 Date.now()-lasttime \u003e 3000) {\n p2life -= 3;\n p2flash=true;\n lasttime = Date.now();\n }\n movement();\n movement1();\n if (player.y\u003e480||life\u003c=0) {\n setBackdrop('red');\n stop();\n sound.play('gg.mp3');\n }\n if (p2.y\u003e480||p2life\u003c=0) {\n setBackdrop('blue');\n stop();\n sound.play('gg.mp3');\n }\n if (score\u003ebest) {\n DB.variables.set('bestscore',score);\n }\n print('當前分數:'+score,10,40,'white',20);\n print('歷史分數:'+best,10,70,'white',20);\n}); \nplayer.when(\"touch\", stairs, function(a) {\n vy = 0;\n player.y = a.y-23;\n if (a.costumeId == 4) {\n player.x += 2;\n }\n if (a.costumeId == 1) {\n vy=-7;\n }\n if (a.costumeId == 5) {\n player.x -= 2;\n }\n if (a.costumeId === 0 \u0026\u0026 a != touchOn) {\n life -= 3;\n flash=true;\n }\n if (a.costumeId == 2 \u0026\u0026 life \u003c 10 \u0026\u0026 a != touchOn) {\n life += 1;\n }\n if (a.costumeId == 3 \u0026\u0026 a != touchOn) {\n setTimeout(function() {\n a.hidden = true;\n }, 300);\n }\n touchOn = a;\n});\np2.when(\"touch\", stairs, function(a) {\n vy = 0;\n p2.y = a.y-23;\n if (a.costumeId == 4) {\n p2.x += 2;\n }\n if (a.costumeId == 1) {\n vy=-7;\n }\n if (a.costumeId == 5) {\n p2.x -= 2;\n }\n if (a.costumeId === 0 \u0026\u0026 a != touchOn1) {\n p2life -= 3;\n flash=true;\n }\n if (a.costumeId == 2 \u0026\u0026 life \u003c 10 \u0026\u0026 a != touchOn1) {\n p2life += 1;\n }\n if (a.costumeId == 3 \u0026\u0026 a != touchOn1) {\n setTimeout(function() {\n a.hidden = true;\n }, 300);\n }\n touchOn1 = a;\n});\nfunction movement(){\n if(key.right){\n if(player.costumeId == 1){\n player.costumeId = 2;\n }else{\n player.costumeId =1;\n }\n }\n else if(key.left){\n if(player.costumeId == 3){\n player.costumeId = 4;\n }else{\n player.costumeId =3;\n }\n }\n else{\n player.costumeId = 0;\n }\n}\nfunction movement1(){\n if(key.d){\n if(p2.costumeId == 1){\n p2.costumeId = 2;\n }else{\n p2.costumeId =1;\n }\n }\n else if(key.a){\n if(p2.costumeId == 3){\n p2.costumeId = 4;\n }else{\n p2.costumeId =3;\n }\n }\n else{\n p2.costumeId = 0;\n }\n}","created_at":"2019-06-01T16:12:53.361+08:00","updated_at":"2020-07-30T13:59:43.396+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/71266/eb21007c5f753591f6e5d312addebeb3.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":95,"hashid":"meys58e2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1247075,"file_name":"jump.mp3","project_id":71266,"asset_id":36478,"created_at":"2019-06-01T16:12:53.366+08:00","updated_at":"2019-06-01T16:12:53.366+08:00"},{"id":1247076,"file_name":"gg.mp3","project_id":71266,"asset_id":36479,"created_at":"2019-06-01T16:12:53.367+08:00","updated_at":"2019-06-01T16:12:53.367+08:00"},{"id":1247077,"file_name":"flash.mp3","project_id":71266,"asset_id":36476,"created_at":"2019-06-01T16:12:53.368+08:00","updated_at":"2019-06-01T16:12:53.368+08:00"},{"id":1247078,"file_name":"bg.mp3","project_id":71266,"asset_id":36477,"created_at":"2019-06-01T16:12:53.369+08:00","updated_at":"2019-06-01T16:12:53.369+08:00"},{"id":1247079,"file_name":"conveyor_left.png","project_id":71266,"asset_id":33485,"created_at":"2019-06-01T16:12:53.370+08:00","updated_at":"2019-06-01T16:12:53.370+08:00"},{"id":1247080,"file_name":"conveyor_right.png","project_id":71266,"asset_id":33486,"created_at":"2019-06-01T16:12:53.371+08:00","updated_at":"2019-06-01T16:12:53.371+08:00"},{"id":1247081,"file_name":"fake.png","project_id":71266,"asset_id":33487,"created_at":"2019-06-01T16:12:53.372+08:00","updated_at":"2019-06-01T16:12:53.372+08:00"},{"id":1247082,"file_name":"normal.png","project_id":71266,"asset_id":33488,"created_at":"2019-06-01T16:12:53.373+08:00","updated_at":"2019-06-01T16:12:53.373+08:00"},{"id":1247083,"file_name":"trampoline.png","project_id":71266,"asset_id":33489,"created_at":"2019-06-01T16:12:53.374+08:00","updated_at":"2019-06-01T16:12:53.374+08:00"},{"id":1247084,"file_name":"nails.png","project_id":71266,"asset_id":33490,"created_at":"2019-06-01T16:12:53.375+08:00","updated_at":"2019-06-01T16:12:53.375+08:00"},{"id":1247085,"file_name":"ceiling.png","project_id":71266,"asset_id":33491,"created_at":"2019-06-01T16:12:53.376+08:00","updated_at":"2019-06-01T16:12:53.376+08:00"},{"id":1247086,"file_name":"wall.png","project_id":71266,"asset_id":33492,"created_at":"2019-06-01T16:12:53.377+08:00","updated_at":"2019-06-01T16:12:53.377+08:00"},{"id":1247087,"file_name":"player_3.png","project_id":71266,"asset_id":33493,"created_at":"2019-06-01T16:12:53.378+08:00","updated_at":"2019-06-01T16:12:53.378+08:00"},{"id":1247088,"file_name":"player_4.png","project_id":71266,"asset_id":33494,"created_at":"2019-06-01T16:12:53.379+08:00","updated_at":"2019-06-01T16:12:53.379+08:00"},{"id":1247089,"file_name":"player_2.png","project_id":71266,"asset_id":33495,"created_at":"2019-06-01T16:12:53.380+08:00","updated_at":"2019-06-01T16:12:53.380+08:00"},{"id":1247090,"file_name":"player_5.png","project_id":71266,"asset_id":33496,"created_at":"2019-06-01T16:12:53.381+08:00","updated_at":"2019-06-01T16:12:53.381+08:00"},{"id":1247091,"file_name":"player_1.png","project_id":71266,"asset_id":33497,"created_at":"2019-06-01T16:12:53.382+08:00","updated_at":"2019-06-01T16:12:53.382+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦