{"id":23987,"student_id":164,"content":"var life = 10;\nvar score = 0;\nvar touchOn;\nvar best = DB.variables.bestScore || 0;\n\nsetBackdrop('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\nvar vy = 0;\nvar stairs = [];\n\nfor(var i=0; i\u003c6; i+=1){\n var stair = createSprite([\"nails.png\",\"trampoline.png\",\"normal.png\",\"fake.png\",\"conveyor_right.png\",\"conveyor_left.png\"]);\n stair.y = i*80+20;\n stair.x = Math.random()*282+179;\n stair.costumeId = Math.floor(Math.random()*5);\n stairs.push(stair)\n}\n\nplayer.when(\"touch\", stairs, function(s){\n vy = 0;\n player.y = s.y - 23;\n});\nplayer.when(\"touch\", stairs, function(stair){\n console.log(stair.costumeId);\n if(stair.costumeId==1){\n vy -= 7;\n }\n if(stair.costumeId==4){\n player.x += 2;\n }\n if(stair.costumeId==5){\n player.x -= 2;\n }\n if(stair.costumeId==3){\n setTimeout(function(){\n stair.hidden = true;\n },300)\n \n }\n });\n player.when(\"touch\", stairs, function (stair){\n if (stair != touchOn \u0026\u0026 stair.costumeId == 0){\n life -= 2;\n } if (stair != touchOn \u0026\u0026 stair.costumeId == 2){\n life += 1;\n }\n touchOn = stair;\n });\nforever(function(){\n for(var i=0; i\u003cstairs.length; i+=1){\n if(stairs[i].y \u003c 0){\n stairs[i].y += 480;\n stairs[i].x = Math.random()*282+179;\n stairs[i].costumeId = Math.floor(Math.random()*5);\n stairs[i].hidden = false;\n score += 1;\n }\n stairs[i].y -= 2;\n }\n if (life \u003c= 0 || player.y \u003e 480) {\n setBackdrop('red');\n stop();\n }\n if (score\u003ebest){\n DB.variables.set('bestScore', score);\n }\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 vy += 0.15;\n player.y += vy;\n print(score, 10, 40, 'red', 20);\n print(life, 10, 10, 'red', 20);\n print(best, 10, 70, 'white', 20);\n sound.play(\"bg.mp3\")\n});","created_at":"2018-03-10T10:11:21.777+08:00","updated_at":"2019-09-16T21:53:32.781+08:00","name":"小朋友下樓梯","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/23987/d1086455be02e0ffdbcaddc045355784.jpg"},"parent_id":13412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":102,"hashid":"yeysqn25","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":455533,"file_name":"jump.mp3","project_id":23987,"asset_id":36478,"created_at":"2018-03-10T10:11:21.789+08:00","updated_at":"2018-03-10T10:11:21.789+08:00"},{"id":455534,"file_name":"gg.mp3","project_id":23987,"asset_id":36479,"created_at":"2018-03-10T10:11:21.792+08:00","updated_at":"2018-03-10T10:11:21.792+08:00"},{"id":455535,"file_name":"flash.mp3","project_id":23987,"asset_id":36476,"created_at":"2018-03-10T10:11:21.795+08:00","updated_at":"2018-03-10T10:11:21.795+08:00"},{"id":455536,"file_name":"bg.mp3","project_id":23987,"asset_id":36477,"created_at":"2018-03-10T10:11:21.797+08:00","updated_at":"2018-03-10T10:11:21.797+08:00"},{"id":455537,"file_name":"conveyor_left.png","project_id":23987,"asset_id":33485,"created_at":"2018-03-10T10:11:21.799+08:00","updated_at":"2018-03-10T10:11:21.799+08:00"},{"id":455538,"file_name":"conveyor_right.png","project_id":23987,"asset_id":33486,"created_at":"2018-03-10T10:11:21.801+08:00","updated_at":"2018-03-10T10:11:21.801+08:00"},{"id":455539,"file_name":"fake.png","project_id":23987,"asset_id":33487,"created_at":"2018-03-10T10:11:21.803+08:00","updated_at":"2018-03-10T10:11:21.803+08:00"},{"id":455540,"file_name":"normal.png","project_id":23987,"asset_id":33488,"created_at":"2018-03-10T10:11:21.805+08:00","updated_at":"2018-03-10T10:11:21.805+08:00"},{"id":455541,"file_name":"trampoline.png","project_id":23987,"asset_id":33489,"created_at":"2018-03-10T10:11:21.806+08:00","updated_at":"2018-03-10T10:11:21.806+08:00"},{"id":455542,"file_name":"nails.png","project_id":23987,"asset_id":33490,"created_at":"2018-03-10T10:11:21.808+08:00","updated_at":"2018-03-10T10:11:21.808+08:00"},{"id":455543,"file_name":"ceiling.png","project_id":23987,"asset_id":33491,"created_at":"2018-03-10T10:11:21.810+08:00","updated_at":"2018-03-10T10:11:21.810+08:00"},{"id":455544,"file_name":"wall.png","project_id":23987,"asset_id":33492,"created_at":"2018-03-10T10:11:21.811+08:00","updated_at":"2018-03-10T10:11:21.811+08:00"},{"id":455545,"file_name":"player_3.png","project_id":23987,"asset_id":33493,"created_at":"2018-03-10T10:11:21.813+08:00","updated_at":"2018-03-10T10:11:21.813+08:00"},{"id":455546,"file_name":"player_4.png","project_id":23987,"asset_id":33494,"created_at":"2018-03-10T10:11:21.815+08:00","updated_at":"2018-03-10T10:11:21.815+08:00"},{"id":455547,"file_name":"player_2.png","project_id":23987,"asset_id":33495,"created_at":"2018-03-10T10:11:21.816+08:00","updated_at":"2018-03-10T10:11:21.816+08:00"},{"id":455548,"file_name":"player_5.png","project_id":23987,"asset_id":33496,"created_at":"2018-03-10T10:11:21.818+08:00","updated_at":"2018-03-10T10:11:21.818+08:00"},{"id":455549,"file_name":"player_1.png","project_id":23987,"asset_id":33497,"created_at":"2018-03-10T10:11:21.820+08:00","updated_at":"2018-03-10T10:11:21.820+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦