{"id":150218,"student_id":10,"content":"// 預設程式碼\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\ncreateSound('bgm.mp3', true)\n\n//-------------------預設程式碼--------------------------------------------//\n\n// 初始化變數\nvar life = 10;\nvar floor = 0;\nvar stairs = [];\nvar vy = 0;\nvar touchOn;\nvar time = 0;\nvar lastTime = 0;\nvar hit;\nvar clock = 0;\n\n//init stairs\n// 1-3,1-4\nfor (var i = 0; i \u003c 8; i++) {\n var stair = createSprite([\"conveyor_left.png\", \"conveyor_right.png\", \"normal.png\", \"nails.png\", \"trampoline.png\", \"fake.png\"]);\n stair.costumeId = Math.floor(Math.random()*6);\n\n stair.x = Math.random()*250 + 200;\n stair.y = i*80 + 550;\n stairs.push(stair);\n}\n\nforever(function() {\n\n if (life \u003e 0 \u0026\u0026 player.y \u003c 480) {\n setBackdrop('black');\n updatePlayer();\n updateStairs();\n\n updateCostume()\n checkTouchedCeiling()\n flashBackground()\n\n } else {\n setBackdrop('red');\n stop();\n createSound('gg.mp3');\n }\n print('分數:' + floor, 10, 10, 'white', 20);\n print('生命:' + life, 10, 40, 'while', 20);\n});\n\n\nfunction updatePlayer() {\n // 1-1\n if (key.left \u0026\u0026 !player.touched(left_wall)) {\n player.x -= 3;\n }\n if (key.right \u0026\u0026 !player.touched(right_wall)) {\n player.x += 3;\n }\n // 1-2\n vy += 0.1;\n player.y += vy;\n}\n\n\n// 1-5\nfunction updateStairs() {\n for (var i = 0; i \u003c stairs.length; i++) {\n stairs[i].y -= 2;\n // 1-6\n if (stairs[i].y \u003c -10) {\n stairs[i].costumeId = Math.floor(Math.random()*6);\n stairs[i].y += 640;\n floor += 1;\n\n stairs[i].hidden = false;\n }\n }\n}\n\n// 2-3\nfunction checkTouchedCeiling() {\n time = Date.now();\n\n if (player.touched(ceiling) \u0026\u0026 time - lastTime \u003e 3000) {\n life -= 3;\n vy = 0;\n lastTime = time;\n hit = true;\n }\n}\n\n// 2-4\nfunction flashBackground() {\n if (hit) {\n setBackdrop('red');\n hit = false;\n createSound('flash.mp3')\n }\n}\n\n// 2-6,2-7\nfunction updateCostume() {\n clock++;\n if (clock%6 == 0) {\n if (key.right) {\n if (player.costumeId == 1) {\n player.costumeId = 2;\n } else {\n player.costumeId = 1;\n }\n }\n if (key.left) {\n if (player.costumeId == 3) {\n player.costumeId = 4;\n } else {\n player.costumeId = 3;\n }\n }\n }\n\n if (key.right == false \u0026\u0026 key.left == false) {\n player.costumeId = 0;\n }\n}\n\n// 1-7\nplayer.when('touch', stairs, function(s) {\n vy = 0;\n player.y = s.y - 20;\n\n // 2-1,2-2\n if (s.costumeId == 0) {\n player.x -= 2;\n }\n if (s.costumeId == 1) {\n player.x += 2;\n }\n if (s.costumeId == 4) {\n vy = -6;\n createSound('jump.mp3')\n }\n if (s.costumeId == 2 \u0026\u0026 s !== touchOn) {\n life += 1;\n }\n if (s.costumeId == 3 \u0026\u0026 s !== touchOn) {\n life -= 3;\n hit = true;\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":"2020-05-22T11:24:42.527+08:00","updated_at":"2020-05-22T11:32:09.507+08:00","name":"小朋友下樓梯_T(下)","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/150218/8f4df770e2edb7d6ad249e568de60787.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":434,"hashid":"9ygsyr2z","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2607071,"file_name":"bgm.mp3","project_id":150218,"asset_id":36477,"created_at":"2020-05-22T11:27:46.901+08:00","updated_at":"2020-05-22T11:27:46.901+08:00"},{"id":2607072,"file_name":"gg.mp3","project_id":150218,"asset_id":36479,"created_at":"2020-05-22T11:27:47.338+08:00","updated_at":"2020-05-22T11:27:47.338+08:00"},{"id":2607074,"file_name":"jump.mp3","project_id":150218,"asset_id":36478,"created_at":"2020-05-22T11:27:51.170+08:00","updated_at":"2020-05-22T11:27:51.170+08:00"},{"id":2607058,"file_name":"player_1.png","project_id":150218,"asset_id":216642,"created_at":"2020-05-22T11:25:37.843+08:00","updated_at":"2020-05-22T11:25:37.843+08:00"},{"id":2607059,"file_name":"player_5.png","project_id":150218,"asset_id":216643,"created_at":"2020-05-22T11:25:37.847+08:00","updated_at":"2020-05-22T11:25:37.847+08:00"},{"id":2607060,"file_name":"player_2.png","project_id":150218,"asset_id":216644,"created_at":"2020-05-22T11:25:37.851+08:00","updated_at":"2020-05-22T11:25:37.851+08:00"},{"id":2607061,"file_name":"player_4.png","project_id":150218,"asset_id":216645,"created_at":"2020-05-22T11:25:37.856+08:00","updated_at":"2020-05-22T11:25:37.856+08:00"},{"id":2607062,"file_name":"player_3.png","project_id":150218,"asset_id":216646,"created_at":"2020-05-22T11:25:37.860+08:00","updated_at":"2020-05-22T11:25:37.860+08:00"},{"id":2607063,"file_name":"wall.png","project_id":150218,"asset_id":216647,"created_at":"2020-05-22T11:25:37.864+08:00","updated_at":"2020-05-22T11:25:37.864+08:00"},{"id":2607064,"file_name":"ceiling.png","project_id":150218,"asset_id":216648,"created_at":"2020-05-22T11:25:37.868+08:00","updated_at":"2020-05-22T11:25:37.868+08:00"},{"id":2607065,"file_name":"nails.png","project_id":150218,"asset_id":216649,"created_at":"2020-05-22T11:25:37.883+08:00","updated_at":"2020-05-22T11:25:37.883+08:00"},{"id":2607066,"file_name":"trampoline.png","project_id":150218,"asset_id":216650,"created_at":"2020-05-22T11:25:37.887+08:00","updated_at":"2020-05-22T11:25:37.887+08:00"},{"id":2607067,"file_name":"normal.png","project_id":150218,"asset_id":216651,"created_at":"2020-05-22T11:25:37.891+08:00","updated_at":"2020-05-22T11:25:37.891+08:00"},{"id":2607068,"file_name":"fake.png","project_id":150218,"asset_id":216652,"created_at":"2020-05-22T11:25:37.895+08:00","updated_at":"2020-05-22T11:25:37.895+08:00"},{"id":2607069,"file_name":"conveyor_right.png","project_id":150218,"asset_id":216653,"created_at":"2020-05-22T11:25:37.898+08:00","updated_at":"2020-05-22T11:25:37.898+08:00"},{"id":2607070,"file_name":"conveyor_left.png","project_id":150218,"asset_id":216654,"created_at":"2020-05-22T11:25:37.902+08:00","updated_at":"2020-05-22T11:25:37.902+08:00"},{"id":2607073,"file_name":"flash.mp3","project_id":150218,"asset_id":36476,"created_at":"2020-05-22T11:27:49.021+08:00","updated_at":"2020-05-22T11:27:49.021+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer