{"id":70009,"student_id":2002,"content":"setBackdrop('black');\nvar life = 10;\nvar score = 0;\nsound.play(\"bg.mp3\");\nvar best = DB.variables.bestScore || 0;\nvar flash = false;\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;\nleft_wall.y = 240;\nright_wall.y = 240;\n\n// 創造階梯\nvar stairs = [];\nvar y = 0;\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.y = 240+y;\n stair.x = Math.random() * 179 + 282;\n stair.costumeId = Math.floor(Math.random()*6);\n stairs.push(stair);\n y += 80;\n}\n\n// 創造玩家\nvar player = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\nvar vy = 0;\nplayer.y = 50;\nplayer.x = 320;\nvar lasttime = 0;\nforever(function() {\n setBackdrop(\"black\");\n if (flash === true) {\n setBackdrop(\"red\");\n sound.play(\"flash.mp3\");\n flash = false;\n }\n if (score \u003e best) {\n DB.variables.set(\"bestScore\", score);\n }\n if (life \u003c= 0 || player.y \u003e 480) {\n setBackdrop(\"#ff0000\");\n stop();\n sound.play(\"gg.mp3\");\n\n }\n print(\"生命:\" + life, 10, 10, \"#ff0000\", 20);\n print(\"當前分數:\" + score, 10, 30, \"#ff0000\", 20);\n print(\"歷史分數:\" + best, 10, 50, \"#ff0000\", 20);\n if (key.right \u0026\u0026 player.touched(right_wall) === false) {\n if (player.costumeId === 1) {\n player.costumeId = 2;\n } else {\n player.costumeId = 1;\n }\n } else if (key.left \u0026\u0026 player.touched(left_wall) === false)\n if (player.costumeId === 3) {\n player.costumeId = 4;\n } else {\n player.costumeId = 3;\n } else {\n player.costumeId = 0;\n }\n if (key.right \u0026\u0026 player.touched(right_wall) === false) {\n player.x += 3;\n }\n if (key.left \u0026\u0026 player.touched(left_wall) === false)\n player.x -= 3;\n vy += 0.15;\n player.y += vy;\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].hidden = false;\n stairs[i].x = Math.random() * 179 + 282;\n stairs[i].costumeId = Math.floor(Math.random()*6);\n score += 1;\n }\n }\n if (player.touched(ceiling) \u0026\u0026 Date.now() - lasttime \u003e 3000) {\n life -= 1;\n lasttime = Date.now();\n }\n});\nvar touchOn;\nplayer.when(\"touch\", stairs, function(s) {\n vy = 0;\n player.y = s.y - 20;\n if (s.costumeId === 1) {\n vy = -7;\n }\n if (s.costumeId === 5) {\n player.x -= 2;\n }\n if (s.costumeId === 4) {\n player.x += 2;\n }\n if (s.costumeId === 0 \u0026\u0026 s != touchOn) {\n life -= 3;\n flash = true;\n }\n if (s.costumeId === 2 \u0026\u0026 life \u003c 10 \u0026\u0026 s != touchOn) {\n life += 1;\n }\n if (s.costumeId === 3 \u0026\u0026 s != touchOn) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n }\n touchOn = s;\n});\n// var life2 = 10;\n// var score2 = 0;\n// var flash2 = false;\n\n// // 創造玩家\n// var player2 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"player_4.png\", \"player_5.png\"]);\n// var vy2 = 0;\n// player2.y = 50;\n// player2.x = 320;\n// var lasttime2 = 0;\n// forever(function() {\n// setBackdrop(\"black\");\n// if (flash2 === true) {\n// setBackdrop(\"blue\");\n// sound.play(\"flash.mp3\");\n// flash2 = false;\n// }\n// if (score2 \u003e best) {\n// DB.variables.set(\"bestScore\", score);\n// }\n// if (life2 \u003c= 0 || player2.y \u003e 480) {\n// setBackdrop(\"blue\");\n// stop();\n// sound.play(\"gg.mp3\");\n\n// }\n// print(\"生命2:\" + life2, 530, 10, \"#ff0000\", 20);\n// print(\"當前分數2:\" + score2, 530, 30, \"#ff0000\", 20);\n// if (key.d \u0026\u0026 player2.touched(right_wall) === false) {\n// if (player2.costumeId === 1) {\n// player2.costumeId = 2;\n// } else {\n// player2.costumeId = 1;\n// }\n// } else if (key.a \u0026\u0026 player2.touched(left_wall) === false)\n// if (player2.costumeId === 3) {\n// player2.costumeId = 4;\n// } else {\n// player2.costumeId = 3;\n// } else {\n// player2.costumeId = 0;\n// }\n// if (key.d \u0026\u0026 player2.touched(right_wall) === false) {\n// player2.x += 3;\n// }\n// if (key.a \u0026\u0026 player2.touched(left_wall) === false)\n// player2.x -= 3;\n// vy2 += 0.15;\n// player2.y += vy2;\n// for (var i = 0; i \u003c stairs.length; i++) {\n// if (stairs[i].y \u003c 0) {\n// score += 1;\n// }\n// if (player2.touched(ceiling) \u0026\u0026 Date.now() - lasttime2 \u003e 3000) {\n// life2 -= 1;\n// lasttime2 = Date.now();\n// }\n// });\n// var touchOn2;\n// player2.when(\"touch\", stairs, function(a) {\n// vy2 = 0;\n// player2.y = a.y - 20;\n// if (a.costumeId === 1) {\n// vy2 = -7;\n// }\n// if (a.costumeId === 5) {\n// player2.x -= 2;\n// }\n// if (a.costumeId === 4) {\n// player2.x += 2;\n// }\n// if (a.costumeId === 0 \u0026\u0026 a != touchOn2) {\n// life2 -= 3;\n// flash2 = true;\n// }\n// if (a.costumeId === 2 \u0026\u0026 life2 \u003c 10 \u0026\u0026 a != touchOn2) {\n// life2 += 1;\n// }\n// if (a.costumeId === 3 \u0026\u0026 a != touchOn2) {\n// setTimeout(function() {\n// a.hidden = true;\n// }, 300);\n// }\n// touchOn2 = a;\n// });","created_at":"2019-05-25T19:51:54.127+08:00","updated_at":"2020-04-16T21:12:54.354+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/70009/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":61,"hashid":"6rps3kg5","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1226753,"file_name":"jump.mp3","project_id":70009,"asset_id":36478,"created_at":"2019-05-25T19:51:54.132+08:00","updated_at":"2019-05-25T19:51:54.132+08:00"},{"id":1226754,"file_name":"gg.mp3","project_id":70009,"asset_id":36479,"created_at":"2019-05-25T19:51:54.133+08:00","updated_at":"2019-05-25T19:51:54.133+08:00"},{"id":1226755,"file_name":"flash.mp3","project_id":70009,"asset_id":36476,"created_at":"2019-05-25T19:51:54.134+08:00","updated_at":"2019-05-25T19:51:54.134+08:00"},{"id":1226756,"file_name":"bg.mp3","project_id":70009,"asset_id":36477,"created_at":"2019-05-25T19:51:54.135+08:00","updated_at":"2019-05-25T19:51:54.135+08:00"},{"id":1226757,"file_name":"conveyor_left.png","project_id":70009,"asset_id":33485,"created_at":"2019-05-25T19:51:54.136+08:00","updated_at":"2019-05-25T19:51:54.136+08:00"},{"id":1226758,"file_name":"conveyor_right.png","project_id":70009,"asset_id":33486,"created_at":"2019-05-25T19:51:54.137+08:00","updated_at":"2019-05-25T19:51:54.137+08:00"},{"id":1226759,"file_name":"fake.png","project_id":70009,"asset_id":33487,"created_at":"2019-05-25T19:51:54.138+08:00","updated_at":"2019-05-25T19:51:54.138+08:00"},{"id":1226760,"file_name":"normal.png","project_id":70009,"asset_id":33488,"created_at":"2019-05-25T19:51:54.139+08:00","updated_at":"2019-05-25T19:51:54.139+08:00"},{"id":1226761,"file_name":"trampoline.png","project_id":70009,"asset_id":33489,"created_at":"2019-05-25T19:51:54.139+08:00","updated_at":"2019-05-25T19:51:54.139+08:00"},{"id":1226762,"file_name":"nails.png","project_id":70009,"asset_id":33490,"created_at":"2019-05-25T19:51:54.140+08:00","updated_at":"2019-05-25T19:51:54.140+08:00"},{"id":1226763,"file_name":"ceiling.png","project_id":70009,"asset_id":33491,"created_at":"2019-05-25T19:51:54.141+08:00","updated_at":"2019-05-25T19:51:54.141+08:00"},{"id":1226764,"file_name":"wall.png","project_id":70009,"asset_id":33492,"created_at":"2019-05-25T19:51:54.142+08:00","updated_at":"2019-05-25T19:51:54.142+08:00"},{"id":1226765,"file_name":"player_3.png","project_id":70009,"asset_id":33493,"created_at":"2019-05-25T19:51:54.143+08:00","updated_at":"2019-05-25T19:51:54.143+08:00"},{"id":1226766,"file_name":"player_4.png","project_id":70009,"asset_id":33494,"created_at":"2019-05-25T19:51:54.144+08:00","updated_at":"2019-05-25T19:51:54.144+08:00"},{"id":1226767,"file_name":"player_2.png","project_id":70009,"asset_id":33495,"created_at":"2019-05-25T19:51:54.145+08:00","updated_at":"2019-05-25T19:51:54.145+08:00"},{"id":1226768,"file_name":"player_5.png","project_id":70009,"asset_id":33496,"created_at":"2019-05-25T19:51:54.146+08:00","updated_at":"2019-05-25T19:51:54.146+08:00"},{"id":1226769,"file_name":"player_1.png","project_id":70009,"asset_id":33497,"created_at":"2019-05-25T19:51:54.147+08:00","updated_at":"2019-05-25T19:51:54.147+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦