{"id":13591,"student_id":10,"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_2.png\",\"player_3.png\",\"player_4.png\",\"player_5.png\"]);\nplayer.y = 50;\n//---------------------------------------------------------------//\n\nvar stairs = []; // 存放階梯角色的陣列\nvar vy = 0; // 玩家垂直移動速度\nvar life = 10; // 玩家生命\nvar score = 0; // 紀錄階梯個數\n// var clock = 0; // 用來計算玩家走路動畫切換造型的時機\n// var lastTime = 0; // 天花板在一定的時間內不會重複扣血\n// var flash; // 紀錄是否要閃爍畫面\n// var touchOn; // 儲存玩家當前踩到的階梯,防止某些階梯效果不斷觸發\n\nfor(var i=0; i\u003c7; i++) {\n var stair = createSprite([\n \"conveyor_left.png\",\n \"conveyor_right.png\",\n \"trampoline.png\",\n \"normal.png\",\n \"nails.png\",\n \"fake.png\"\n ]);\n\tstair.x = Math.random()*290 + 185;\n stair.y = i*80;\n stair.costumeId = Math.floor(Math.random()*6);\n stairs.push(stair);\n}\n\nforever(function() {\n\tif (key.left \u0026\u0026 !player.touched(left_wall)) {\n \tplayer.x -= 3;\n }\n if (key.right \u0026\u0026 !player.touched(right_wall)) {\n \tplayer.x += 3;\n }\n \n vy += 0.15;\n player.y += vy; // 根據玩家下降速度移動角色 y 座標\n\n// // 如果沒有按下左右按鍵就恢復正面造型\n// if (key.right == false \u0026\u0026 key.left == false) {\n// player.costumeId = 0;\n// }\n\n for (var i=0; i\u003cstairs.length; i++) {\n \tstairs[i].y -= 2;\n if(stairs[i].y \u003c -10) {\n stairs[i].costumeId = Math.floor(Math.random()*5);\n \tstairs[i].y += 640;\n \tstairs[i].x = Math.random()*290 + 185;\n }\n }\n// if (life \u003c= 0 || player.y \u003e 500) {\n// \tsetBackdrop('red');\n// stop();\n// }\n \n// // 3000ms(三秒內)不會重複扣血\n// var time = Date.now();\n// if (player.touched(ceiling) \u0026\u0026 time - lastTime \u003e 3000) {\n// life -= 3;\n// lastTime = time;\n// flash = true;\n// vy = 0;\n// }\n// print(floor, 370, 10, 'red', 20);\n// print(life, 10, 10, 'red', 20);\n});\n\nplayer.when('touch',stairs, function(s) {\n// if(player.y \u003e s.y) return; // 防止跳起來碰撞到上方階梯\n vy = 0;\n player.y = s.y - 20; //固定角色位置在當前的階梯上方\n\t\n\tif(s.costumeId == 0) { //向左傳送帶\n \tplayer.x -= 2;\n }\n if(s.costumeId == 1) { //向右傳送帶\n \tplayer.x += 2;\n }\n if(s.costumeId == 2) { //彈簧階梯\n vy = -7;\n }\n if(s.costumeId == 3 \u0026\u0026 s != touchOn) { //一般藍色階梯\n \tlife += 1;\n }\n if(s.costumeId == 4 \u0026\u0026 s != touchOn) { //釘子階梯\n \tlife -= 3;\n }\n if(s.costumeId == 5 \u0026\u0026 s != touchOn) { //灰色階梯\n// setTimeout(function() {\n// s.hidden = true\n// }, 300);\n }\n touchOn = s; // 粉重要!\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-09T01:38:38.451+08:00","name":"小朋友下樓梯","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/13591/cf2776e548ebb2f3bc5880727be4c9d6.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":363,"hashid":"36ysm48j","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":279855,"file_name":"conveyor_left.png","project_id":13591,"asset_id":33485,"created_at":"2017-10-21T10:45:44.126+08:00","updated_at":"2017-10-21T10:45:44.126+08:00"},{"id":279856,"file_name":"conveyor_right.png","project_id":13591,"asset_id":33486,"created_at":"2017-10-21T10:45:44.128+08:00","updated_at":"2017-10-21T10:45:44.128+08:00"},{"id":279857,"file_name":"fake.png","project_id":13591,"asset_id":33487,"created_at":"2017-10-21T10:45:44.130+08:00","updated_at":"2017-10-21T10:45:44.130+08:00"},{"id":279858,"file_name":"normal.png","project_id":13591,"asset_id":33488,"created_at":"2017-10-21T10:45:44.136+08:00","updated_at":"2017-10-21T10:45:44.136+08:00"},{"id":279859,"file_name":"trampoline.png","project_id":13591,"asset_id":33489,"created_at":"2017-10-21T10:45:44.138+08:00","updated_at":"2017-10-21T10:45:44.138+08:00"},{"id":279860,"file_name":"nails.png","project_id":13591,"asset_id":33490,"created_at":"2017-10-21T10:45:44.140+08:00","updated_at":"2017-10-21T10:45:44.140+08:00"},{"id":279861,"file_name":"ceiling.png","project_id":13591,"asset_id":33491,"created_at":"2017-10-21T10:45:44.142+08:00","updated_at":"2017-10-21T10:45:44.142+08:00"},{"id":279862,"file_name":"wall.png","project_id":13591,"asset_id":33492,"created_at":"2017-10-21T10:45:44.143+08:00","updated_at":"2017-10-21T10:45:44.143+08:00"},{"id":279863,"file_name":"player_3.png","project_id":13591,"asset_id":33493,"created_at":"2017-10-21T10:45:44.145+08:00","updated_at":"2017-10-21T10:45:44.145+08:00"},{"id":279864,"file_name":"player_4.png","project_id":13591,"asset_id":33494,"created_at":"2017-10-21T10:45:44.147+08:00","updated_at":"2017-10-21T10:45:44.147+08:00"},{"id":279865,"file_name":"player_2.png","project_id":13591,"asset_id":33495,"created_at":"2017-10-21T10:45:44.149+08:00","updated_at":"2017-10-21T10:45:44.149+08:00"},{"id":279866,"file_name":"player_5.png","project_id":13591,"asset_id":33496,"created_at":"2017-10-21T10:45:44.150+08:00","updated_at":"2017-10-21T10:45:44.150+08:00"},{"id":279867,"file_name":"player_1.png","project_id":13591,"asset_id":33497,"created_at":"2017-10-21T10:45:44.152+08:00","updated_at":"2017-10-21T10:45:44.152+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦