{"id":30254,"student_id":73,"content":"setBackdrop('black');\nvar life = 10;\nvar score = 0;\nvar stairs = [];\nvar clock = 0\nvar vy = 0;\nvar touchOn\nvar touch = false\nvar best = DB.variables.bestScore || 0;\nvar flash = false\nsound.play\nconsole.log('目前最好成績:'+ best)\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;\nplayer.x = 320;\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.costumeId = Math.floor(Math.random()*6)\n stair.x = Math.random()*282+179\n stair.y = i*80\n stairs.push(stair)\n}\nplayer.when(\"touch\", stairs, function(s) {\n vy = 0;\n player.y = s.y - 23;\n // console.log (stair.costumed)\n if (stair.costumeId == 1) {\n vy = -5\n } else if (stair.costumeId == 4) {\n player.x += 2\n } else if (stair.costumeId == 5) {\n player.x -= 2\n } else if (stair != touchOn \u0026\u0026 s.costumeId == 0) {\n flash = true\n setTimeout(function() {\n flash = false\n }, 10);\n life -= 3\n } else if (stair != touchOn \u0026\u0026 s.costumeId == 2 \u0026\u0026 life \u003c 10) {\n life++\n } else if (stair.costumeId == 3) {\n setTimeout(function() {\n s.hidden = true\n }, 250);\n }\n touchOn = s\n})\n\n\n\nforever(function() {\n if(flash == true){\nflash =false;\n}\n clock++\n vy += 0.15\n\n if (player.touched(ceiling) \u0026\u0026 touch == false) {\n life -= 3\n touch = true\n setTimeout(function() {\n touch = false\n }, 3000);\n }\n if (key.left \u0026\u0026 !player.touched(left_wall)) {\n player.x -= 3\n }\n if (key.right \u0026\u0026 !player.touched(right_wall)) {\n player.x += 3\n }\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 -10) {\n stairs[i].y = 480\n stairs[i].x = Math.random()*282+179\n stairs[i].costumeId = Math.floor(Math.random()*6)\n score++\n stairs[i].hidden = false\n }\n }\n if (clock%6 == 0) {\n if (key.right) {\n if (player.costumeId == 1) {\n player.costumeId = 2;\n } else {\n player.costumeId = 1;\n }\n } else if (key.left) {\n if (player.costumeId == 3) {\n player.costumeId = 4\n } else {\n player.costumeId = 3\n }\n } else {\n player.costumeId = 0\n }\n }\n \n \n \n if (life \u003c 1 || player.y \u003e 480) {\n setBackdrop(\"red\")\n if (best \u003c score) {\n DB.variables.set(\"bestScore\", score);\n }\n stop()\n\n }\n // if (player.touched(ceiling)){\n // touchOn = ceiling\n \n // if(ceiling !=touchOn){\n // life -= 3\n // }\n\n // }\n\n print(\"分數 : \"+ score, 20, 10, \" white\", 20)\n print(\"血量 : \"+ life, 20, 30, \"white\", 20)\n})","created_at":"2018-05-26T18:57:44.788+08:00","updated_at":"2019-10-13T20:05:23.005+08:00","name":"小朋友下樓梯","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/30254/10c925383c35d6bb6109aad6b85d38ec.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":160,"hashid":"npms4e6v","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":563557,"file_name":"fake.png","project_id":30254,"asset_id":33487,"created_at":"2018-05-26T18:57:44.804+08:00","updated_at":"2018-05-26T18:57:44.804+08:00"},{"id":563551,"file_name":"jump.mp3","project_id":30254,"asset_id":36478,"created_at":"2018-05-26T18:57:44.795+08:00","updated_at":"2018-05-26T18:57:44.795+08:00"},{"id":563552,"file_name":"gg.mp3","project_id":30254,"asset_id":36479,"created_at":"2018-05-26T18:57:44.797+08:00","updated_at":"2018-05-26T18:57:44.797+08:00"},{"id":563553,"file_name":"flash.mp3","project_id":30254,"asset_id":36476,"created_at":"2018-05-26T18:57:44.798+08:00","updated_at":"2018-05-26T18:57:44.798+08:00"},{"id":563554,"file_name":"bg.mp3","project_id":30254,"asset_id":36477,"created_at":"2018-05-26T18:57:44.800+08:00","updated_at":"2018-05-26T18:57:44.800+08:00"},{"id":563555,"file_name":"conveyor_left.png","project_id":30254,"asset_id":33485,"created_at":"2018-05-26T18:57:44.801+08:00","updated_at":"2018-05-26T18:57:44.801+08:00"},{"id":563556,"file_name":"conveyor_right.png","project_id":30254,"asset_id":33486,"created_at":"2018-05-26T18:57:44.802+08:00","updated_at":"2018-05-26T18:57:44.802+08:00"},{"id":563558,"file_name":"normal.png","project_id":30254,"asset_id":33488,"created_at":"2018-05-26T18:57:44.805+08:00","updated_at":"2018-05-26T18:57:44.805+08:00"},{"id":563559,"file_name":"trampoline.png","project_id":30254,"asset_id":33489,"created_at":"2018-05-26T18:57:44.807+08:00","updated_at":"2018-05-26T18:57:44.807+08:00"},{"id":563560,"file_name":"nails.png","project_id":30254,"asset_id":33490,"created_at":"2018-05-26T18:57:44.808+08:00","updated_at":"2018-05-26T18:57:44.808+08:00"},{"id":563561,"file_name":"ceiling.png","project_id":30254,"asset_id":33491,"created_at":"2018-05-26T18:57:44.810+08:00","updated_at":"2018-05-26T18:57:44.810+08:00"},{"id":563562,"file_name":"wall.png","project_id":30254,"asset_id":33492,"created_at":"2018-05-26T18:57:44.811+08:00","updated_at":"2018-05-26T18:57:44.811+08:00"},{"id":563563,"file_name":"player_3.png","project_id":30254,"asset_id":33493,"created_at":"2018-05-26T18:57:44.813+08:00","updated_at":"2018-05-26T18:57:44.813+08:00"},{"id":563564,"file_name":"player_4.png","project_id":30254,"asset_id":33494,"created_at":"2018-05-26T18:57:44.814+08:00","updated_at":"2018-05-26T18:57:44.814+08:00"},{"id":563565,"file_name":"player_2.png","project_id":30254,"asset_id":33495,"created_at":"2018-05-26T18:57:44.816+08:00","updated_at":"2018-05-26T18:57:44.816+08:00"},{"id":563566,"file_name":"player_5.png","project_id":30254,"asset_id":33496,"created_at":"2018-05-26T18:57:44.817+08:00","updated_at":"2018-05-26T18:57:44.817+08:00"},{"id":563567,"file_name":"player_1.png","project_id":30254,"asset_id":33497,"created_at":"2018-05-26T18:57:44.819+08:00","updated_at":"2018-05-26T18:57:44.819+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦