{"id":19924,"student_id":119,"content":"setBackdrop('black');\nvar time = Date.now();\nvar getpoint = 0;\nvar getpoint2 = 0;\nvar lasttime = 0;\nvar vy = 0;\nvar vy2 = 0;\nvar flash = false;\nvar touchon = 6;\nvar touchon2 = 6;\nvar life = 10;\nvar life2 = 10;\nvar score = 0;\nvar score2 = 0;\nvar ceiling = createSprite(\"ceiling.png\");\nceiling.x = 320;\nceiling.y = 8;\nceiling.layer = 1;\nvar left_wall = createSprite(\"wall.png\");\nvar right_wall = createSprite(\"wall.png\");\nleft_wall.x = 130;\nright_wall.x = 510;\nvar stairs = [];\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.random() * 282 + 179\n stair.y = i * 80 + 80\n stair.costumeId = Math.floor(Math.random() * 6)\n stairs.push(stair)\n}\nvar player = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nvar player2 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nplayer.y = 50;\nplayer2.y = 50;\nforever(function () {\n setBackdrop(\"black\");\n for (var ui = 0; ui \u003c 6; ui++) { }\n if (key.right \u0026\u0026 !player.touched(right_wall)) { player.x += 3 }\n if (key.left \u0026\u0026 !player.touched(left_wall)) { player.x -= 3 }\n if (key.d \u0026\u0026 !player2.touched(right_wall)) { player2.x += 3 }\n if (key.a \u0026\u0026 !player2.touched(left_wall)) { player2.x -= 3 }\n vy += 0.15\n player.y += vy\n vy2 += 0.15\n player2.y += vy2\n for (var suyf = 0; suyf \u003c 6; suyf++) {\n stairs[suyf].y -= 2\n if (stairs[suyf].y \u003c 0) {\n stairs[suyf].y = 480;\n stairs[suyf].x = Math.random() * 282 + 179;\n stairs[suyf].costumeId = Math.floor(Math.random() * 6);\n stairs[suyf].hidden = false\n if (getpoint = 1) { score2++; }\n else if (getpoint2 = 1) { score++; } else { score++; score2++; }\n }\n }\n if (player.y \u003e 479) { getpoint = 1 }\n if (player2.y \u003e 479) { getpoint2 = 1 }\n if (player.touched(ceiling) \u0026\u0026 time - lasttime \u003e 3000) { life -= 3; lasttime = time }\n if (player2.touched(ceiling) \u0026\u0026 time - lasttime \u003e 3000) { life2 -= 3; lasttime = time }\n print(\"player1生命:\" + life, 0, 60, \"red\", 25)\n print(\"player1分數:\" + score, 0, 30, \"red\", 25)\n print(\"player2生命:\" + life2, 380, 60, \"red\", 25)\n print(\"player2分數:\" + score2, 380, 30, \"red\", 25)\n time = Date.now();\n});\n\nplayer.when(\"touch\", stairs, function (s) {\n vy = 0;\n player.y = s.y - 23;\n if (s.costumeId == 1) {\n vy = -7\n } else if (s.costumeId == 4) { player.x += 2 }\n else if (s.costumeId == 5) { player.x -= 2 }\n else if (s.costumeId != touchon \u0026\u0026 s.costumeId == 0) { life -= 3; setBackdrop(\"red\"); }\n else if (s.costumeId != touchon \u0026\u0026 s.costumeId == 2 \u0026\u0026 life \u003c 10) { life += 1 }\n else if (s.costumeId == 3) {\n setTimeout(function () {\n s.hidden = true;\n }, 300)\n }\n touchon = s.costumeId;\n});\nplayer2.when(\"touch\", stairs, function (s) {\n vy2 = 0;\n player2.y = s.y - 23;\n if (s.costumeId == 1) {\n vy2 = -7\n } else if (s.costumeId == 4) { player2.x += 2 }\n else if (s.costumeId == 5) { player2.x -= 2 }\n else if (s.costumeId != touchon2 \u0026\u0026 s.costumeId == 0) { life2 -= 3; setBackdrop(\"red\"); }\n else if (s.costumeId != touchon2 \u0026\u0026 s.costumeId == 2 \u0026\u0026 life2 \u003c 10) { life2 += 1 }\n else if (s.costumeId == 3) {\n setTimeout(function () {\n s.hidden = true;\n }, 1000)\n }\n touchon2 = s.costumeId;\n});\nplayer2.when(\"touch\", stairs, function (stair) {\n console.log(stair.costumeId)\n});","created_at":"2018-01-13T10:07:26.226+08:00","updated_at":"2019-10-27T03:44:22.964+08:00","name":"小朋友下樓梯","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/19924/ac8b7c0d874a83e80e4774dfcd78af5c.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":136,"hashid":"p93s4rr2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":393118,"file_name":"conveyor_left.png","project_id":19924,"asset_id":33485,"created_at":"2018-01-13T10:07:26.233+08:00","updated_at":"2018-01-13T10:07:26.233+08:00"},{"id":393119,"file_name":"conveyor_right.png","project_id":19924,"asset_id":33486,"created_at":"2018-01-13T10:07:26.236+08:00","updated_at":"2018-01-13T10:07:26.236+08:00"},{"id":393120,"file_name":"fake.png","project_id":19924,"asset_id":33487,"created_at":"2018-01-13T10:07:26.238+08:00","updated_at":"2018-01-13T10:07:26.238+08:00"},{"id":393121,"file_name":"normal.png","project_id":19924,"asset_id":33488,"created_at":"2018-01-13T10:07:26.239+08:00","updated_at":"2018-01-13T10:07:26.239+08:00"},{"id":393122,"file_name":"trampoline.png","project_id":19924,"asset_id":33489,"created_at":"2018-01-13T10:07:26.241+08:00","updated_at":"2018-01-13T10:07:26.241+08:00"},{"id":393123,"file_name":"nails.png","project_id":19924,"asset_id":33490,"created_at":"2018-01-13T10:07:26.243+08:00","updated_at":"2018-01-13T10:07:26.243+08:00"},{"id":393124,"file_name":"ceiling.png","project_id":19924,"asset_id":33491,"created_at":"2018-01-13T10:07:26.244+08:00","updated_at":"2018-01-13T10:07:26.244+08:00"},{"id":393125,"file_name":"wall.png","project_id":19924,"asset_id":33492,"created_at":"2018-01-13T10:07:26.246+08:00","updated_at":"2018-01-13T10:07:26.246+08:00"},{"id":393126,"file_name":"player_3.png","project_id":19924,"asset_id":33493,"created_at":"2018-01-13T10:07:26.248+08:00","updated_at":"2018-01-13T10:07:26.248+08:00"},{"id":393127,"file_name":"player_4.png","project_id":19924,"asset_id":33494,"created_at":"2018-01-13T10:07:26.249+08:00","updated_at":"2018-01-13T10:07:26.249+08:00"},{"id":393128,"file_name":"player_2.png","project_id":19924,"asset_id":33495,"created_at":"2018-01-13T10:07:26.251+08:00","updated_at":"2018-01-13T10:07:26.251+08:00"},{"id":393129,"file_name":"player_5.png","project_id":19924,"asset_id":33496,"created_at":"2018-01-13T10:07:26.253+08:00","updated_at":"2018-01-13T10:07:26.253+08:00"},{"id":393130,"file_name":"player_1.png","project_id":19924,"asset_id":33497,"created_at":"2018-01-13T10:07:26.254+08:00","updated_at":"2018-01-13T10:07:26.254+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦