{"id":177894,"student_id":10,"content":"setBackdrop('#000')\nvar build = createSprite('tower_0.png', 'tower_1.png');\nvar ceiling = createSprite('ceiling.png');\nvar player = createSprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png', 'p_4.png', 'p_5.png');\n\nsetBackdrop(\"black\")\n\nvar life = 10; //生命值\nvar floor = 0; //層數\nvar stairs = []; //存放階梯角色\nvar vy = 0; //垂直墜落的速度\nvar touchOn; //當前碰到的階梯\nvar flash = false; //是否閃爍\nvar clock = 0; //紀錄遊戲迴圈執行的次數\n\nceiling.y = 20;\nceiling.layer = 1;\n\nfor (var i = 0; i \u003c 7; i++) {\n var s = createSprite('s_0.png', 's_1.png', 's_2.png', 's_3.png', 's_4.png', 's_5.png');\n s.y = i*150;\n s.x = 300 + Math.random()*600;\n s.costumeId = Math.floor(Math.random()*6);\n stairs.push(s);\n s.scale *= 1.3;\n}\n\nforever(loop);\nplayer.on('touch', stairs, onTouchStair);\ncreateSound('bgm.mp3', true);\n\n// 遊戲迴圈\nfunction loop () {\n updatePlayer();\n updateStairs();\n updateCostume();\n updateInfo();\n updateBackground();\n gameoverCheck();\n}\n\n// 更新所有階梯\nfunction updateStairs () {\n for (var i = 0; i \u003c stairs.length; i++) {\n var s = stairs[i];\n s.y -= 3;\n if (s.y \u003c -10) {\n s.y += 1050;\n s.x = 300 + Math.random()*600;\n s.costumeId = Math.floor(Math.random()*6);\n s.hidden = false;\n floor += 1;\n }\n }\n}\n\n// 更新玩家角色位置\nfunction updatePlayer () {\n if (key.left) {\n player.x -= 12;\n }\n if (key.right) {\n player.x += 12;\n }\n vy += 0.6;\n player.y += vy;\n}\n\n// 更新玩家角色位置\nfunction onTouchStair (s) {\n vy = 0;\n player.y = s.y - 55;\n\n if (s.costumeId == 0) {\n player.x -= 6;\n }\n if (s.costumeId == 1) {\n player.x += 6;\n }\n if (s.costumeId == 2) {\n vy = -12;\n createSound('jump.mp3');\n }\n if (s.costumeId == 3 \u0026\u0026 s != touchOn) {\n life += 1;\n }\n if (s.costumeId == 4 \u0026\u0026 s != touchOn) {\n life -= 3;\n flash = true;\n createSound('hit.mp3');\n }\n if (s.costumeId == 5 \u0026\u0026 s != touchOn) {\n setTimeout(function() {\n s.hidden = true;\n }, 500);\n }\n touchOn = s;\n}\n\n// 顯示遊戲分數與玩家生命\nfunction updateInfo () {\n drawText('分數:' + floor, 10, 10, 'white', 30);\n drawText('生命:' + life, 10, 40, 'white', 30);\n}\n\n// 檢查是否遊戲結束\nfunction gameoverCheck () {\n if (life \u003c= 0 || player.y \u003e 1000 || player.touched(ceiling)) {\n // bg.costumeId = 1;\n stop();\n createSound('gg.mp3');\n }\n}\n\n// 更新背景動畫\nfunction updateBackground () {\n build.y -= 3;\n if (build.y \u003c 0) {\n build.y += 2700;\n }\n if (flash) {\n build.costumeId = 1;\n flash = false;\n } else {\n build.costumeId = 0;\n }\n}\n\n// 玩家角色動畫\nfunction updateCostume () {\n clock++;\n if (clock%5 == 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}","created_at":"2020-08-07T18:44:21.889+08:00","updated_at":"2020-09-07T11:09:54.975+08:00","name":"小朋友下樓梯 副本","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/177894/ca0e9ae291979e56ee8ae79cb7a8c448.jpg"},"parent_id":138319,"plugin":"Game.set({width:1200, height:900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":224,"hashid":"d5ms592n","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3037375,"file_name":"jump.mp3","project_id":177894,"asset_id":36478,"created_at":"2020-08-07T18:44:21.895+08:00","updated_at":"2020-08-07T18:44:21.895+08:00"},{"id":3037376,"file_name":"hit.mp3","project_id":177894,"asset_id":36476,"created_at":"2020-08-07T18:44:21.897+08:00","updated_at":"2020-08-07T18:44:21.897+08:00"},{"id":3037377,"file_name":"bgm.mp3","project_id":177894,"asset_id":36477,"created_at":"2020-08-07T18:44:21.898+08:00","updated_at":"2020-08-07T18:44:21.898+08:00"},{"id":3037378,"file_name":"gg.mp3","project_id":177894,"asset_id":36479,"created_at":"2020-08-07T18:44:21.899+08:00","updated_at":"2020-08-07T18:44:21.899+08:00"},{"id":3037379,"file_name":"tower_1.png","project_id":177894,"asset_id":246934,"created_at":"2020-08-07T18:44:21.899+08:00","updated_at":"2020-08-07T18:44:21.899+08:00"},{"id":3037380,"file_name":"tower_0.png","project_id":177894,"asset_id":246933,"created_at":"2020-08-07T18:44:21.900+08:00","updated_at":"2020-08-07T18:44:21.900+08:00"},{"id":3037383,"file_name":"s_5.png","project_id":177894,"asset_id":246930,"created_at":"2020-08-07T18:44:21.903+08:00","updated_at":"2020-08-07T18:44:21.903+08:00"},{"id":3037384,"file_name":"s_4.png","project_id":177894,"asset_id":246929,"created_at":"2020-08-07T18:44:21.904+08:00","updated_at":"2020-08-07T18:44:21.904+08:00"},{"id":3037385,"file_name":"s_3.png","project_id":177894,"asset_id":246928,"created_at":"2020-08-07T18:44:21.905+08:00","updated_at":"2020-08-07T18:44:21.905+08:00"},{"id":3037386,"file_name":"s_2.png","project_id":177894,"asset_id":246927,"created_at":"2020-08-07T18:44:21.906+08:00","updated_at":"2020-08-07T18:44:21.906+08:00"},{"id":3037387,"file_name":"s_1.png","project_id":177894,"asset_id":246926,"created_at":"2020-08-07T18:44:21.907+08:00","updated_at":"2020-08-07T18:44:21.907+08:00"},{"id":3037388,"file_name":"s_0.png","project_id":177894,"asset_id":246925,"created_at":"2020-08-07T18:44:21.908+08:00","updated_at":"2020-08-07T18:44:21.908+08:00"},{"id":3037389,"file_name":"p_4.png","project_id":177894,"asset_id":246924,"created_at":"2020-08-07T18:44:21.908+08:00","updated_at":"2020-08-07T18:44:21.908+08:00"},{"id":3037390,"file_name":"p_3.png","project_id":177894,"asset_id":246923,"created_at":"2020-08-07T18:44:21.909+08:00","updated_at":"2020-08-07T18:44:21.909+08:00"},{"id":3037391,"file_name":"p_2.png","project_id":177894,"asset_id":246922,"created_at":"2020-08-07T18:44:21.910+08:00","updated_at":"2020-08-07T18:44:21.910+08:00"},{"id":3037392,"file_name":"p_1.png","project_id":177894,"asset_id":246921,"created_at":"2020-08-07T18:44:21.911+08:00","updated_at":"2020-08-07T18:44:21.911+08:00"},{"id":3037393,"file_name":"p_0.png","project_id":177894,"asset_id":246920,"created_at":"2020-08-07T18:44:21.912+08:00","updated_at":"2020-08-07T18:44:21.912+08:00"},{"id":3037394,"file_name":"ceiling.png","project_id":177894,"asset_id":246919,"created_at":"2020-08-07T18:44:21.913+08:00","updated_at":"2020-08-07T18:44:21.913+08:00"},{"id":3233288,"file_name":"sky_1.png","project_id":177894,"asset_id":259511,"created_at":"2020-09-07T11:06:03.538+08:00","updated_at":"2020-09-07T11:06:03.538+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦