{"id":71144,"student_id":234,"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;\nleft_wall.y = 240;\nright_wall.x = 510;\nright_wall.y = 240;\n\n// 創造玩家\nvar player = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer.x = 480;\nplayer.y = 50;\nvar player2 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer2.x = 240;\nplayer2.y = 50;\n\nvar vy = 0;\nvar vy2 = 0;\n\n//var touchOn = 0;\nvar time = 0;\nvar time2 = 0;\nvar stairs = [];\nvar counter = 0;\nvar counter2 = 0;\nvar life = 10;\nvar life2 = 10;\nvar score = 0;\nvar score2 = 0;\nvar time =0;\nvar time_old = 0;\nvar time_old2 = 0;\nvar best = DB.variables.best || 0;\nvar dead = false;\nvar dead2 = false;\nfor (var i = 0; i \u003c 6; i++) {\n var stair = createSprite([\"nails.png\", \"trampoline.png\", \"normal.png\", \"fake.png\", \"conveyor_right.png\", \"conveyor_left.png\"]);\n stair.x = Math.floor(Math.random() *283 +179);\n stair.y = 320+ 80 *i;\n stair.costumeId = Math.floor(Math.random() *6);\n stairs.push(stair);\n}\nplayer.hidden = false;\nplayer2.hidden = false;\nplayer.when(\"touch\", stairs, function(s) {\n setBackdrop('black');\n player.y = s.y -23;\n vy = 0;\n console.log(s.costumeId);\n if (s !== player.touchOn \u0026\u0026 s.costumeId === 0) {\n life -= 3;\n setBackdrop('red');\n }\n if (s.costumeId === 1) {\n vy -= 7.5;\n }\n if (s !== player.touchOn \u0026\u0026 s.costumeId === 2 \u0026\u0026 life \u003c 10) {\n life ++;\n }\n if (s.costumeId === 3) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n }\n if (s.costumeId === 4) {\n player.x += 2;\n }\n if (s.costumeId === 5) {\n player.x -= 2;\n }\n player.touchOn = s;\n});\nplayer2.when(\"touch\", stairs, function(s) {\n setBackdrop('black');\n player2.y = s.y -23;\n vy2 = 0;\n console.log(s.costumeId);\n if (s !== player2.touchOn \u0026\u0026 s.costumeId === 0) {\n life2 -= 3;\n setBackdrop('red');\n }\n if (s.costumeId === 1) {\n vy2 -= 7.5;\n }\n if (s !== player2.touchOn \u0026\u0026 s.costumeId === 2 \u0026\u0026 life2 \u003c 10) {\n life2 ++;\n }\n if (s.costumeId === 3) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n }\n if (s.costumeId === 4) {\n player2.x += 2;\n }\n if (s.costumeId === 5) {\n player2.x -= 2;\n }\n player2.touchOn = s;\n});\nforever(function() {\n /* Do this every tick */\n print(\"life = \" + life, 525, 10, \"white\", 30);\n print(\"life2 = \" + life2, 10, 10, \"white\", 30);\n print(\"score = \" + score, 450, 30, \"white\", 30);\n print(\"score2 = \" + score2, 10, 30, \"white\", 30);\n print(\"bestScore = \" + best, 10, 50, \"white\", 30);\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].costumeId = Math.floor(Math.random() *6);\n stairs[i].x = Math.floor(Math.random() *283 +179);\n stairs[i].y = 480;\n stairs[i].hidden = false;\n if (dead !== true) {\n score++;\n }\n if (dead2 !== true) {\n score2 ++;\n }\n \n }\n }\n if (key.right \u0026\u0026 !right_wall.touched(player)) {\n player.x += 3;\n player.costumeId = 1;\n }\n if (key.d \u0026\u0026 !right_wall.touched(player2)) {\n player2.x += 3;\n player2.costumeId = 1;\n }\n if (key.left \u0026\u0026 !left_wall.touched(player)) {\n player.x -= 3;\n player.costumeId = 3;\n }\n if (key.a \u0026\u0026 !left_wall.touched(player2)) {\n player2.x -= 3;\n player2.costumeId = 3;\n }\n if (!key.right \u0026\u0026 !key.left) {\n player.costumeId = 0;\n }\n if (!key.d \u0026\u0026 !key.a) {\n player2.costumeId = 0;\n }\n player.y += vy;\n vy += 0.15;\n player2.y += vy2;\n vy2 += 0.15;\n if (key.right || key.left) {\n counter ++;\n }\n if (key.a || key.d) {\n counter2 ++;\n }\n time = Date.now();\n if (player.touched(ceiling) \u0026\u0026 (time - time_old) \u003e 3000) {\n life -= 3;\n setBackdrop('red');\n time_old = time;\n }\n if (player2.touched(ceiling) \u0026\u0026 (time - time_old2) \u003e 3000) {\n life2 -= 3;\n setBackdrop('red');\n time_old2 = time;\n }\n if (life \u003c= 0 || player.y \u003e 480) {\n dead = true;\n player.hidden = true;\n life = 0;\n if (best \u003c score) {\n DB.variables.set('best', score);\n }\n if (dead2 == true \u0026\u0026 dead == true) {\n setBackdrop('red');\n stop();\n }\n }\n if (life2 \u003c= 0 || player2.y \u003e 480) {\n dead2 = true;\n player2.hidden = true;\n life2 = 0;\n if (best \u003c score2) {\n DB.variables.set('best', score2);\n }\n if (dead2 == true \u0026\u0026 dead == true) {\n setBackdrop('red');\n stop();\n }\n }\n});","created_at":"2019-06-01T15:05:11.786+08:00","updated_at":"2019-10-07T04:01:03.092+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/71144/599c0cb2fb345641b4cac3c50eb457a7.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":76,"hashid":"meys58qp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1245122,"file_name":"jump.mp3","project_id":71144,"asset_id":36478,"created_at":"2019-06-01T15:05:11.790+08:00","updated_at":"2019-06-01T15:05:11.790+08:00"},{"id":1245123,"file_name":"gg.mp3","project_id":71144,"asset_id":36479,"created_at":"2019-06-01T15:05:11.791+08:00","updated_at":"2019-06-01T15:05:11.791+08:00"},{"id":1245124,"file_name":"flash.mp3","project_id":71144,"asset_id":36476,"created_at":"2019-06-01T15:05:11.792+08:00","updated_at":"2019-06-01T15:05:11.792+08:00"},{"id":1245125,"file_name":"bg.mp3","project_id":71144,"asset_id":36477,"created_at":"2019-06-01T15:05:11.793+08:00","updated_at":"2019-06-01T15:05:11.793+08:00"},{"id":1245126,"file_name":"conveyor_left.png","project_id":71144,"asset_id":33485,"created_at":"2019-06-01T15:05:11.794+08:00","updated_at":"2019-06-01T15:05:11.794+08:00"},{"id":1245127,"file_name":"conveyor_right.png","project_id":71144,"asset_id":33486,"created_at":"2019-06-01T15:05:11.795+08:00","updated_at":"2019-06-01T15:05:11.795+08:00"},{"id":1245128,"file_name":"fake.png","project_id":71144,"asset_id":33487,"created_at":"2019-06-01T15:05:11.796+08:00","updated_at":"2019-06-01T15:05:11.796+08:00"},{"id":1245129,"file_name":"normal.png","project_id":71144,"asset_id":33488,"created_at":"2019-06-01T15:05:11.796+08:00","updated_at":"2019-06-01T15:05:11.796+08:00"},{"id":1245130,"file_name":"trampoline.png","project_id":71144,"asset_id":33489,"created_at":"2019-06-01T15:05:11.797+08:00","updated_at":"2019-06-01T15:05:11.797+08:00"},{"id":1245131,"file_name":"nails.png","project_id":71144,"asset_id":33490,"created_at":"2019-06-01T15:05:11.798+08:00","updated_at":"2019-06-01T15:05:11.798+08:00"},{"id":1245132,"file_name":"ceiling.png","project_id":71144,"asset_id":33491,"created_at":"2019-06-01T15:05:11.799+08:00","updated_at":"2019-06-01T15:05:11.799+08:00"},{"id":1245133,"file_name":"wall.png","project_id":71144,"asset_id":33492,"created_at":"2019-06-01T15:05:11.800+08:00","updated_at":"2019-06-01T15:05:11.800+08:00"},{"id":1245134,"file_name":"player_3.png","project_id":71144,"asset_id":33493,"created_at":"2019-06-01T15:05:11.801+08:00","updated_at":"2019-06-01T15:05:11.801+08:00"},{"id":1245135,"file_name":"player_4.png","project_id":71144,"asset_id":33494,"created_at":"2019-06-01T15:05:11.802+08:00","updated_at":"2019-06-01T15:05:11.802+08:00"},{"id":1245136,"file_name":"player_2.png","project_id":71144,"asset_id":33495,"created_at":"2019-06-01T15:05:11.802+08:00","updated_at":"2019-06-01T15:05:11.802+08:00"},{"id":1245137,"file_name":"player_5.png","project_id":71144,"asset_id":33496,"created_at":"2019-06-01T15:05:11.803+08:00","updated_at":"2019-06-01T15:05:11.803+08:00"},{"id":1245138,"file_name":"player_1.png","project_id":71144,"asset_id":33497,"created_at":"2019-06-01T15:05:11.804+08:00","updated_at":"2019-06-01T15:05:11.804+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦