{"id":47788,"student_id":1661,"content":"setBackdrop('black');\nvar life = 10;\nvar score = 0;\nvar touchOn;\nvar clock = 0;\nvar vy = 0;\nvar lastTime = 0;\nvar left_wall = createSprite(\"wall.png\");\nvar right_wall = createSprite(\"wall.png\");\nvar best = DB.variables.bestScore || 0;\nvar ceiling = createSprite(\"ceiling.png\");\nvar stairs = [];\nvar flash;\nvar player1 = createSprite([\"player_1.png\", \"player_2.png\", \"player_3.png\", \"play_4.png\", \"play_5.png\"]);\nvar lasttime = 0;\nsound.play('bg.mp3');\nforever(function() {\n if (flash === true) {\n setBackdrop('red');\n } else {\n setBackdrop('black');\n }\n if (flash === true) {\n sound.play('flash.mp3');\n flash = false;\n }\n\n});\n\nceiling.x = 320;\nceiling.y = 8;\nceiling.layer = 1;\n\nleft_wall.x = 130;\nright_wall.x = 510;\n\nplayer1.y = 50;\n\nfor (var i = 1; 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 = 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 vy = 0;\n player1.y = s.y-23;\n if (s.costumeId == 1) {\n vy -= 7;\n }\n if (s.costumeId == 4) {\n player1.x -= 2;\n sound.play('jump.mp3');\n }\n if (s.costumeId == 5) {\n player1.x -= 2;\n }\n if (s.costumeId === 0 \u0026\u0026 s !== touchOn) {\n life -= 3;\n }\n if (s.costumeId === 2 \u0026\u0026 s !== touchOn) {\n if (life \u003c 10) {\n life += 1;\n }\n }\n if (s.costumeId === 3 \u0026\u0026 s !== touchOn) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n }\n touchOn = s;\n});\nforever(function() {\n player1.y += vy;\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 stairs[i].y -= 2;\n if (stairs[i].y\u003c-10) {\n stairs[i].y = 480;\n score += 1;\n stairs[i].hidden = false;\n }\n }\n if (player1.y \u003e= 480 || life \u003c 0) {\n setBackdrop(\"red\");\n stop();\n sound.play('gg.mp3');\n if (score \u003e best) {\n DB.variables.set(\"bestScore\", score);\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 }\n vy += 0.15;\n if (clock % 6 === 0) {\n if (key.left) {\n if (player1.costumeId == 3) {\n player1.costumeId = 4;\n } else {\n player1.costumeId = 3;\n }\n\n } else if\n (key.right) {\n if (player1.costumeId == 1) {\n player1.costumeId = 2;\n } else {\n player1.costumeId = 1;\n }\n }\n }\n clock += 1;\n print(\"生命\" +life, 10, 30, \"white\", 30);\n print(\"分數\" +score, 10, 70, \"white\", 30);\n print(\"當前紀錄:\", 530, 20, \"white\", 30);\n print(best, 530, 50, \"white\", 30);\n});","created_at":"2018-11-04T09:54:16.571+08:00","updated_at":"2021-01-22T09:31:23.209+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/47788/fc2fd546727c6a970bc8f153a61e3339.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":122,"hashid":"36ys5yr9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":855669,"file_name":"jump.mp3","project_id":47788,"asset_id":36478,"created_at":"2018-11-04T09:54:16.585+08:00","updated_at":"2018-11-04T09:54:16.585+08:00"},{"id":855670,"file_name":"gg.mp3","project_id":47788,"asset_id":36479,"created_at":"2018-11-04T09:54:16.587+08:00","updated_at":"2018-11-04T09:54:16.587+08:00"},{"id":855671,"file_name":"flash.mp3","project_id":47788,"asset_id":36476,"created_at":"2018-11-04T09:54:16.592+08:00","updated_at":"2018-11-04T09:54:16.592+08:00"},{"id":855672,"file_name":"bg.mp3","project_id":47788,"asset_id":36477,"created_at":"2018-11-04T09:54:16.594+08:00","updated_at":"2018-11-04T09:54:16.594+08:00"},{"id":855673,"file_name":"conveyor_left.png","project_id":47788,"asset_id":33485,"created_at":"2018-11-04T09:54:16.596+08:00","updated_at":"2018-11-04T09:54:16.596+08:00"},{"id":855674,"file_name":"conveyor_right.png","project_id":47788,"asset_id":33486,"created_at":"2018-11-04T09:54:16.598+08:00","updated_at":"2018-11-04T09:54:16.598+08:00"},{"id":855675,"file_name":"fake.png","project_id":47788,"asset_id":33487,"created_at":"2018-11-04T09:54:16.603+08:00","updated_at":"2018-11-04T09:54:16.603+08:00"},{"id":855676,"file_name":"normal.png","project_id":47788,"asset_id":33488,"created_at":"2018-11-04T09:54:16.606+08:00","updated_at":"2018-11-04T09:54:16.606+08:00"},{"id":855677,"file_name":"trampoline.png","project_id":47788,"asset_id":33489,"created_at":"2018-11-04T09:54:16.609+08:00","updated_at":"2018-11-04T09:54:16.609+08:00"},{"id":855678,"file_name":"nails.png","project_id":47788,"asset_id":33490,"created_at":"2018-11-04T09:54:16.612+08:00","updated_at":"2018-11-04T09:54:16.612+08:00"},{"id":855679,"file_name":"ceiling.png","project_id":47788,"asset_id":33491,"created_at":"2018-11-04T09:54:16.615+08:00","updated_at":"2018-11-04T09:54:16.615+08:00"},{"id":855680,"file_name":"wall.png","project_id":47788,"asset_id":33492,"created_at":"2018-11-04T09:54:16.618+08:00","updated_at":"2018-11-04T09:54:16.618+08:00"},{"id":855681,"file_name":"player_3.png","project_id":47788,"asset_id":33493,"created_at":"2018-11-04T09:54:16.621+08:00","updated_at":"2018-11-04T09:54:16.621+08:00"},{"id":855682,"file_name":"player_4.png","project_id":47788,"asset_id":33494,"created_at":"2018-11-04T09:54:16.625+08:00","updated_at":"2018-11-04T09:54:16.625+08:00"},{"id":855683,"file_name":"player_2.png","project_id":47788,"asset_id":33495,"created_at":"2018-11-04T09:54:16.628+08:00","updated_at":"2018-11-04T09:54:16.628+08:00"},{"id":855684,"file_name":"player_5.png","project_id":47788,"asset_id":33496,"created_at":"2018-11-04T09:54:16.632+08:00","updated_at":"2018-11-04T09:54:16.632+08:00"},{"id":855685,"file_name":"player_1.png","project_id":47788,"asset_id":33497,"created_at":"2018-11-04T09:54:16.635+08:00","updated_at":"2018-11-04T09:54:16.635+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦