{"id":22247,"student_id":1444,"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;\nright_wall.x = 510;\n\n// 創造玩家\nvar player = createSprite([\"player_1.png\",\"player_5.png\t\",\"player_2.png\",\"player_4.png\",\"player_3.png\"]);\nplayer.y = 50;\nvar clock = 0;\nvar life = 10;\nvar floor = 0;\nvar stairs = []\nvar lasttime = 0;\nvar hit = false;\n\nfor (var i = 0;i \u003c 8;i++)\n{\n var stair = createSprite([\"nails.png\",\"trampoline.png\",\"normal.png\",\"fake.png\",\"conveyor_right.png\",\"conveyor_left.png\"]);\n stair.x = Math.random()*290 + 185;\n stair.y = i*90 +500;\n stair.costumeId = Math.floor(Math.random()*6);\n stairs.push(stair);\n}\n\nvar vy = 0;\nsound.play(\"bg.mp3\");\n\nforever(function(){\n setBackdrop('black');\n if(hit) {\n setBackdrop('red');\n hit = false;\n sound.play(\"flash.mp3\")\n }\n\n player.y += vy;\n //人物左右\n if (key.left \u0026\u0026 !player.touched(left_wall))\n {\n player.x -= 3;\n }\n if (key.right \u0026\u0026 !player.touched(right_wall))\n {\n player.x += 3;\n }\n if (!player.touched(stair))\n {\n vy +=0.15;\n }\n\n clock++\n if (clock % 6 == 0)\n {\n if (key.left){\n if (player.costumeId == 1){\n player.costumeId = 3;\n }else {\n player.costumeId = 1;\n }\n }\n if (key.right){\n if (player.costumeId == 4){\n player.costumeId = 2;\n }else {\n player.costumeId = 4;\n }\n }\n }\n if (key.left == false \u0026\u0026 key.right == false)\n {\n player.costumeId = 0;\n }\n\n //stair出現\n for (var i = 0;i \u003c stairs.length;i++)\n {\n stairs[i].y -= 2;\n if (stairs[i].y \u003c -15)\n {\n stairs[i].costumeId =Math.floor(Math.random()*5);\n stairs[i].y +=640;\n floor += 1;\n stairs[i].hidden = false;\n }\n }\n\n var time = Date.now();\n if (player.touched(ceiling) \u0026\u0026 time - lasttime \u003e 3000){\n life -= 3;\n lasttime = time;\n hit = true;\n vy = 0;\n }\n\n if (life \u003c= 0 || player.y \u003e 480){\n setBackdrop('red');\n stop();\n sound.play(\"gg.mp3\");\n }\n\n print (\"score : \"+floor,10,10,'red',20);\n print (\"Life : \"+life,10,40,'red',20);\n});\n player.when('touch',stairs, function(s) \n {\n if (player.y \u003e s.y) \n {\n return;\n }\n vy = 0;\n player.y = s.y - 20;\n\n if (s.costumeId == 1){\n vy = -7;\n sound.play(\"jump.mp3\");\n }\n if (s.costumeId == 4){\n player.x += 2;\n }\n if (s.costumeId == 5){\n player.x -= 2;\n }\n \n if (s.costumeId == 0 \u0026\u0026 s !== player.touchOn) {\n \t life -= 3;\n hit = true;\n }\n player.touchOn = s;\n if (s.costumeId == 2 \u0026\u0026 life \u003c= 10 \u0026\u0026 s !== player.touchOn){\n life++;\n }\n if (s.costumeId == 3){\n setTimeout(function(){\n s.hidden = true;\n },300);\n }\n \n });","created_at":"2018-02-12T17:58:05.541+08:00","updated_at":"2019-10-24T00:13:33.520+08:00","name":"小朋友下樓梯","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/22247/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":128,"hashid":"p93s4wqw","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":429610,"file_name":"conveyor_left.png","project_id":22247,"asset_id":33485,"created_at":"2018-02-12T17:58:05.559+08:00","updated_at":"2018-02-12T17:58:05.559+08:00"},{"id":429611,"file_name":"conveyor_right.png","project_id":22247,"asset_id":33486,"created_at":"2018-02-12T17:58:05.565+08:00","updated_at":"2018-02-12T17:58:05.565+08:00"},{"id":429612,"file_name":"fake.png","project_id":22247,"asset_id":33487,"created_at":"2018-02-12T17:58:05.570+08:00","updated_at":"2018-02-12T17:58:05.570+08:00"},{"id":429613,"file_name":"normal.png","project_id":22247,"asset_id":33488,"created_at":"2018-02-12T17:58:05.573+08:00","updated_at":"2018-02-12T17:58:05.573+08:00"},{"id":429614,"file_name":"trampoline.png","project_id":22247,"asset_id":33489,"created_at":"2018-02-12T17:58:05.578+08:00","updated_at":"2018-02-12T17:58:05.578+08:00"},{"id":429615,"file_name":"nails.png","project_id":22247,"asset_id":33490,"created_at":"2018-02-12T17:58:05.581+08:00","updated_at":"2018-02-12T17:58:05.581+08:00"},{"id":429616,"file_name":"ceiling.png","project_id":22247,"asset_id":33491,"created_at":"2018-02-12T17:58:05.585+08:00","updated_at":"2018-02-12T17:58:05.585+08:00"},{"id":429617,"file_name":"wall.png","project_id":22247,"asset_id":33492,"created_at":"2018-02-12T17:58:05.589+08:00","updated_at":"2018-02-12T17:58:05.589+08:00"},{"id":429618,"file_name":"player_3.png","project_id":22247,"asset_id":33493,"created_at":"2018-02-12T17:58:05.594+08:00","updated_at":"2018-02-12T17:58:05.594+08:00"},{"id":429619,"file_name":"player_4.png","project_id":22247,"asset_id":33494,"created_at":"2018-02-12T17:58:05.599+08:00","updated_at":"2018-02-12T17:58:05.599+08:00"},{"id":429620,"file_name":"player_2.png","project_id":22247,"asset_id":33495,"created_at":"2018-02-12T17:58:05.602+08:00","updated_at":"2018-02-12T17:58:05.602+08:00"},{"id":429621,"file_name":"player_5.png","project_id":22247,"asset_id":33496,"created_at":"2018-02-12T17:58:05.608+08:00","updated_at":"2018-02-12T17:58:05.608+08:00"},{"id":429622,"file_name":"player_1.png","project_id":22247,"asset_id":33497,"created_at":"2018-02-12T17:58:05.612+08:00","updated_at":"2018-02-12T17:58:05.612+08:00"},{"id":451864,"file_name":"bg.mp3","project_id":22247,"asset_id":36477,"created_at":"2018-03-08T00:15:54.107+08:00","updated_at":"2018-03-08T00:15:54.107+08:00"},{"id":451865,"file_name":"flash.mp3","project_id":22247,"asset_id":36476,"created_at":"2018-03-08T00:15:54.110+08:00","updated_at":"2018-03-08T00:15:54.110+08:00"},{"id":451866,"file_name":"gg.mp3","project_id":22247,"asset_id":36479,"created_at":"2018-03-08T00:15:55.011+08:00","updated_at":"2018-03-08T00:15:55.011+08:00"},{"id":451867,"file_name":"jump.mp3","project_id":22247,"asset_id":36478,"created_at":"2018-03-08T00:15:55.014+08:00","updated_at":"2018-03-08T00:15:55.014+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦