{"id":9007,"student_id":10,"content":"let bg = createSprite(['bg.jpg', 'bg2.jpg']);\nlet ceiling = createSprite('ceiling.png');\nlet left_wall = createSprite('wall.png');\nlet right_wall = createSprite('wall.png');\nlet player = createSprite(['p1.png', 'p2.png', 'p3.png', 'p4.png', 'p5.png']);\n\nleft_wall.x = 130;\nright_wall.x = 510;\nceiling.moveTo(320, 8);\nceiling.layer = 1;\nplayer.y = 50;\n\nlet life = 10;\nlet floor = 0;\nlet stairs = [];\nlet vy = 0;\nlet touchOn;\nlet hit = false;\nlet clock = 0;\n\nplayer.on('touch', stairs, onTouchStair);\nforever(loop);\n\nfunction loop () {\n updatePlayer();\n updateStairs();\n updateCostume();\n updateInfo();\n updateBackground();\n gameoverCheck();\n}\n\nfor (let i = 0; i \u003c 8; i++) {\n let s = createSprite(['s0.png', 's1.png', 's2.png', 's3.png', 's4.png', 's5.png']);\n s.costumeId = Math.floor(Math.random()*6);\n s.x = Math.random()*250 + 200;\n s.y = i*80 + 550;\n stairs.push(s);\n}\n\nfunction updatePlayer () {\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 vy += 0.1;\n player.y += vy;\n}\n\nfunction updateStairs () {\n for (let i = 0; i \u003c stairs.length; i++) {\n let s = stairs[i];\n s.y -= 2;\n if (s.y \u003c -10) {\n s.y += 640;\n s.costumeId = Math.floor(Math.random()*6);\n s.hidden = false;\n floor += 1;\n }\n }\n}\n\nfunction onTouchStair (s) {\n vy = 0;\n player.y = s.y - 20;\n\n if (s.costumeId == 0) {\n player.x -= 2;\n }\n if (s.costumeId == 1) {\n player.x += 2;\n }\n if (s.costumeId == 2) {\n vy = -6;\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 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}\n\nfunction updateInfo () {\n print('分數:' + floor, 10, 10, 'white', 20);\n print('生命:' + life, 10, 40, 'while', 20);\n}\n\nfunction gameoverCheck () {\n if (life \u003c= 0 || player.y \u003e 480 || player.touched(ceiling)) {\n bg.costumeId = 1;\n stop();\n }\n}\n\nfunction updateBackground () {\n bg.y -= 0.5;\n if (bg.y \u003c 190) {\n bg.y += 100;\n }\n bg.costumeId = 0;\n if (hit) {\n bg.costumeId = 1;\n hit = false;\n }\n}\n\nfunction updateCostume () {\n clock++;\n if (clock%3 == 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":"2017-03-01T20:52:04.729+08:00","updated_at":"2020-05-22T11:22:39.135+08:00","name":"小朋友下樓梯_T","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/9007/3bf4d4f3b42cd095f766609273576858.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":484,"hashid":"vngs3je","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2022048,"file_name":"bg2.jpg","project_id":9007,"asset_id":175959,"created_at":"2019-12-31T14:31:09.939+08:00","updated_at":"2019-12-31T14:31:09.939+08:00"},{"id":2022049,"file_name":"bg.jpg","project_id":9007,"asset_id":175960,"created_at":"2019-12-31T14:31:09.946+08:00","updated_at":"2019-12-31T14:31:09.946+08:00"},{"id":2022050,"file_name":"s0.png","project_id":9007,"asset_id":175961,"created_at":"2019-12-31T14:31:09.950+08:00","updated_at":"2019-12-31T14:31:09.950+08:00"},{"id":2022051,"file_name":"s1.png","project_id":9007,"asset_id":175962,"created_at":"2019-12-31T14:31:09.955+08:00","updated_at":"2019-12-31T14:31:09.955+08:00"},{"id":2022052,"file_name":"s5.png","project_id":9007,"asset_id":175963,"created_at":"2019-12-31T14:31:09.959+08:00","updated_at":"2019-12-31T14:31:09.959+08:00"},{"id":2022053,"file_name":"s3.png","project_id":9007,"asset_id":175964,"created_at":"2019-12-31T14:31:09.963+08:00","updated_at":"2019-12-31T14:31:09.963+08:00"},{"id":2022054,"file_name":"s2.png","project_id":9007,"asset_id":175965,"created_at":"2019-12-31T14:31:09.968+08:00","updated_at":"2019-12-31T14:31:09.968+08:00"},{"id":2022055,"file_name":"s4.png","project_id":9007,"asset_id":175966,"created_at":"2019-12-31T14:31:09.972+08:00","updated_at":"2019-12-31T14:31:09.972+08:00"},{"id":2022056,"file_name":"ceiling.png","project_id":9007,"asset_id":175967,"created_at":"2019-12-31T14:31:09.976+08:00","updated_at":"2019-12-31T14:31:09.976+08:00"},{"id":2022057,"file_name":"wall.png","project_id":9007,"asset_id":175968,"created_at":"2019-12-31T14:31:09.981+08:00","updated_at":"2019-12-31T14:31:09.981+08:00"},{"id":2022058,"file_name":"p3.png","project_id":9007,"asset_id":175969,"created_at":"2019-12-31T14:31:09.985+08:00","updated_at":"2019-12-31T14:31:09.985+08:00"},{"id":2022059,"file_name":"p4.png","project_id":9007,"asset_id":175970,"created_at":"2019-12-31T14:31:09.989+08:00","updated_at":"2019-12-31T14:31:09.989+08:00"},{"id":2022060,"file_name":"p2.png","project_id":9007,"asset_id":175971,"created_at":"2019-12-31T14:31:09.993+08:00","updated_at":"2019-12-31T14:31:09.993+08:00"},{"id":2022061,"file_name":"p5.png","project_id":9007,"asset_id":175972,"created_at":"2019-12-31T14:31:09.997+08:00","updated_at":"2019-12-31T14:31:09.997+08:00"},{"id":2022062,"file_name":"p1.png","project_id":9007,"asset_id":175973,"created_at":"2019-12-31T14:31:10.001+08:00","updated_at":"2019-12-31T14:31:10.001+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