{"id":206904,"student_id":12205,"content":"setBackdrop('black');\nvar time = 0;\nvar lasttime = 0;\nvar touchOn = 0;\nvar hit = false;\nvar adds = createSprite('add.png');\nadds.x = 0;\nadds.y = 490;\n\n\nvar flash = createSprite('下載 (1).png');\nflash.x = 528;\nflash.y = 390;\nflash.scale = 0.000001;\n// 創造天花板\nvar ceiling = createSprite(\"ceiling.png\");\nceiling.x = 320;\nceiling.y = 8;\nceiling.layer = 1;\n\n\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;\nvar vy = 0;\n\n//創造階梯\nvar stairs = [];\nfor (var i = 0; i \u003c 6; i++) {\n var stair = createSprite([\"conveyor_left.png\", \"conveyor_right.png\", \"fake.png\", \"normal.png\", \"trampoline.png\", \"nails.png\"]);\n stair.costumeId = Math.floor(Math.random()*6);\n stair.x = Math.random()*250+200;\n stair.y = i*80+550;\n stairs.push(stair);\n\n}\n\n\n\nsound.play('bg.mp3');\n// 初始化變數\nvar life = 10;\nvar floor = 0;\n\n//---------------------------預設程式碼------------------------------------//\n\nforever(function() {\n setBackdrop('black');\n checktouchedciling();\n flashBackdrop();\n died ();\n\n print(hit, 10, 10, 'white', 20);\n print('生命:' + life, 10, 40, 'while', 20);\n updatePlayer ();\n for (var i = 0; i \u003c stairs.length; i++) {\n stairs[i].y -= 2;\n\n //階梯迴圈\n if (stairs[i].y \u003c -10) {\n stairs[i].cotumeId = Math.floor(Math.random()*6);\n stairs[i].y += 640;\n stairs[i].x = Math.random()*250+200;\n floor += 1;\n\n }\n //stairs[i].x = Math.random()*250+200;\n\n }\n\n\n});\n\nfunction checktouchedciling() {\n time = Date.now;\n if (player.touched(ceiling) \u0026\u0026 touchOn != ceiling \u0026\u0026 player.touched(stairs) == false) {\n hit = true;\n life -= 3;\n touchOn = ceiling;\n\n }\n\n}\n\nfunction flashBackdrop() {\n setBackdrop('black');\n if (hit == true) {\n setBackdrop('red');\n hit = false;\n }\n\n\n}\n\nfunction updatePlayer () {\n //玩家移動\n if (key.right \u0026\u0026 !player.touched(right_wall)) {\n player.x += 3;\n }\n if (key.left \u0026\u0026 !player.touched(left_wall)) {\n player.x -= 3;\n\n }\n //加速度\n vy += 0.15;\n player.y += vy\n\n}\nplayer.when('touch', stairs, function(s) {\n vy = 0;\n player.y = s.y - 20;\n if (s.costumeId == 4) {\n sound.play(\"jump.mp3\");\n vy = - 7;\n }\n if (s.costumeId == 1) {\n player.x += 2;\n }\n if (s.costumeId == 0) {\n player.x += -2;\n }\n\n if (s.costumeId == 3 \u0026\u0026 s !== player.touchOn) {\n if (life \u003c 10) {\n life += 1;\n }\n }\n if (s.costumeId == 2) {\n setTimeout(function() {\n s.hidden = true;\n }, 300);\n }\n if (s.costumeId == 5 \u0026\u0026 s !== player.touchOn) {\n life += -3;\n hit = true;\n flash = true;\n sound.play(\"flash.mp3\");\n }\n if (life \u003c 5) {\n for (var d = 0; d \u003c 250; d++) {\n adds.y -= 2;\n }\n\n }\n if (player.touched(adds)) {\n life = 10;\n }\n player.touchOn = s;\n //console.log(s.costumeId)\n});\nfunction died () {\n if (life \u003c 1) {\n print('你輸了', 170, 185, 'white', 100);\n setBackdrop(\"red\");\n stop();\n }\n /*if (player.touched(ceiling) \u0026\u0026 Date.now() - player_time \u003e 3000) {\n life -= 3;\n playertime = Date.now();\n //setBackdrop(\"red\");\n //stop();\n }*/\n if (player.y \u003e 480) {\n print('你輸了', 170, 185, 'white', 100);\n life = 0;\n setBackdrop(\"red\");\n stop();\n }\n}","created_at":"2020-11-27T19:09:40.812+08:00","updated_at":"2020-12-02T21:01:02.281+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/206904/8651c9ce43373095d9d54fc55635b91e.jpg"},"parent_id":61784,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":53,"hashid":"5j3s995jp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3594760,"file_name":"conveyor_left.png","project_id":206904,"asset_id":114034,"created_at":"2020-11-27T19:09:40.818+08:00","updated_at":"2020-11-27T19:09:40.818+08:00"},{"id":3594761,"file_name":"conveyor_right.png","project_id":206904,"asset_id":114033,"created_at":"2020-11-27T19:09:40.820+08:00","updated_at":"2020-11-27T19:09:40.820+08:00"},{"id":3594762,"file_name":"fake.png","project_id":206904,"asset_id":114032,"created_at":"2020-11-27T19:09:40.822+08:00","updated_at":"2020-11-27T19:09:40.822+08:00"},{"id":3594763,"file_name":"normal.png","project_id":206904,"asset_id":114031,"created_at":"2020-11-27T19:09:40.823+08:00","updated_at":"2020-11-27T19:09:40.823+08:00"},{"id":3594764,"file_name":"trampoline.png","project_id":206904,"asset_id":114030,"created_at":"2020-11-27T19:09:40.824+08:00","updated_at":"2020-11-27T19:09:40.824+08:00"},{"id":3594765,"file_name":"nails.png","project_id":206904,"asset_id":114029,"created_at":"2020-11-27T19:09:40.825+08:00","updated_at":"2020-11-27T19:09:40.825+08:00"},{"id":3594766,"file_name":"ceiling.png","project_id":206904,"asset_id":114028,"created_at":"2020-11-27T19:09:40.827+08:00","updated_at":"2020-11-27T19:09:40.827+08:00"},{"id":3594767,"file_name":"wall.png","project_id":206904,"asset_id":114027,"created_at":"2020-11-27T19:09:40.828+08:00","updated_at":"2020-11-27T19:09:40.828+08:00"},{"id":3594768,"file_name":"player_3.png","project_id":206904,"asset_id":114026,"created_at":"2020-11-27T19:09:40.829+08:00","updated_at":"2020-11-27T19:09:40.829+08:00"},{"id":3594769,"file_name":"player_4.png","project_id":206904,"asset_id":114025,"created_at":"2020-11-27T19:09:40.830+08:00","updated_at":"2020-11-27T19:09:40.830+08:00"},{"id":3594770,"file_name":"player_2.png","project_id":206904,"asset_id":114024,"created_at":"2020-11-27T19:09:40.832+08:00","updated_at":"2020-11-27T19:09:40.832+08:00"},{"id":3594771,"file_name":"player_5.png","project_id":206904,"asset_id":114023,"created_at":"2020-11-27T19:09:40.833+08:00","updated_at":"2020-11-27T19:09:40.833+08:00"},{"id":3594772,"file_name":"player_1.png","project_id":206904,"asset_id":114022,"created_at":"2020-11-27T19:09:40.834+08:00","updated_at":"2020-11-27T19:09:40.834+08:00"},{"id":3594773,"file_name":"bg.mp3","project_id":206904,"asset_id":114021,"created_at":"2020-11-27T19:09:40.836+08:00","updated_at":"2020-11-27T19:09:40.836+08:00"},{"id":3594774,"file_name":"flash.mp3","project_id":206904,"asset_id":114020,"created_at":"2020-11-27T19:09:40.837+08:00","updated_at":"2020-11-27T19:09:40.837+08:00"},{"id":3594775,"file_name":"gg.mp3","project_id":206904,"asset_id":114019,"created_at":"2020-11-27T19:09:40.838+08:00","updated_at":"2020-11-27T19:09:40.838+08:00"},{"id":3594776,"file_name":"jump.mp3","project_id":206904,"asset_id":114018,"created_at":"2020-11-27T19:09:40.840+08:00","updated_at":"2020-11-27T19:09:40.840+08:00"},{"id":3596402,"file_name":"下載 (1).png","project_id":206904,"asset_id":285193,"created_at":"2020-11-27T21:07:49.537+08:00","updated_at":"2020-11-27T21:07:49.537+08:00"},{"id":3637685,"file_name":"add.png","project_id":206904,"asset_id":289537,"created_at":"2020-12-02T20:46:07.477+08:00","updated_at":"2020-12-02T20:46:07.477+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦