{"id":7797,"student_id":1473,"content":"setBackdrop(\"#000000\");\nvar wheel=createSprite(\"wheel.png\");\nwheel.x=350;\nwheel.y=350;\nwheel.vx=0;\nwheel.vy=0;\nwheel.scale=0.17;\nwheel.falling=false;\nwheel.jumpable=true;\nvar blocks=[];\nvar score=0;\nvar startblock=createSprite(\"startblock.png\");\nstartblock.x=300;//300是startblock的一半寬度\nstartblock.y=450;//450是測試的結果\nvar clock=-1;\nforever(function(){\n clock++;\n if(!wheel.falling){\n wheel.direction+=7;\n }\n if(clock%60==0){\n var block=createSprite(\"block.png\");\n block.x=750-Math.random()*50;\n if(clock==0){\n block.y=300+Math.random()*50;\n }else{\n block.y=150+Math.random()*300;\n }\n blocks.push(block);\n }\n for(var i=0;i\u003cblocks.length;i++){\n blocks[i].x-=5;\n }\n if(blocks[0].x+60\u003c=0){//60是block的一半寬度\n blocks[0].destroy();\n blocks.splice(0,1);\n score++;\n }\n startblock.x-=5;\n if(startblock.x+300\u003c=0){//300是startblock的一半寬度\n startblock.destroy();\n }\n if(wheel.falling){\n wheel.vy+=0.5;\n wheel.y+=wheel.vy;\n if(wheel.vx\u003e0){\n wheel.vx--;\n wheel.x+=wheel.vx;\n }\n }\n wheel.falling=true;\n if(wheel.y\u003c30){\n wheel.vy=0;\n wheel.y=30;\n }\n if(wheel.x\u003e640){\n wheel.vx=0;\n wheel.x=640;\n }\n if(wheel.y\u003e480||wheel.x\u003c25){\n createSprite(\"black.png\");\n print(\"Game over!\",160,200,\"white\",60);\n print(\"final score: \"+score,270,300,\"white\");\n stop();\n }else{\n print(score,20,20,\"white\");\n }\n});\nwheel.when(\"touch\",blocks,function(block){\n wheel.jumpable=false;\n wheel.vx=0;\n if(wheel.y\u003c=block.y+130\u0026\u0026wheel.x\u003eblock.x-60\u0026\u0026wheel.y\u003eblock.y){//130是block的一半高度加wheel的半徑後取保險的結果\n //而60是block的一半寬度\n //bottom\n wheel.falling=true;\n wheel.vy=0;\n wheel.y=block.y+60;\n }else if(wheel.x\u003e=block.x-90\u0026\u0026wheel.y\u003eblock.y-100){//90是block的一半寬度加wheel的半徑後取保險的結果\n //而100是block的一半高度\n //left\n wheel.x=block.x-90;\n wheel.falling=false;\n wheel.y-=8;\n wheel.x++;\n }else{\n //top\n if(wheel.x-5\u003eblock.x-50){\n wheel.jumpable=true;\n }\n wheel.vy=0;\n wheel.falling=false;\n wheel.y=block.y-125;//125是block的一半高度加wheel的半徑後取保險的結果\n }\n }\n);\nwheel.when(\"touch\",startblock,function(){\n wheel.vy=0;\n wheel.falling=false;\n});\nwhen(\"keydown\", \"right\", function(){\n\tif(wheel.jumpable\u0026\u0026!wheel.falling){\n wheel.falling=true;\n wheel.vy=-10;\n wheel.vx=15;\n wheel.jumpable=false;\n }\n});\nwhen(\"keydown\", \"up\", function(){\n if(wheel.jumpable\u0026\u0026!wheel.falling){\n wheel.falling=true;\n wheel.vy=-15;\n wheel.jumpable=false;\n }\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-01T20:03:07.065+08:00","name":"滾動的輪胎","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/7797/d93e205bef7b1b1f093fbf25e003c7da.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":513,"hashid":"kdms5pg","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":174072,"file_name":"startblock.png","project_id":7797,"asset_id":21120,"created_at":"2017-07-05T15:45:58.711+08:00","updated_at":"2017-07-05T15:45:58.711+08:00"},{"id":174073,"file_name":"wheel.png","project_id":7797,"asset_id":21106,"created_at":"2017-07-05T15:46:04.089+08:00","updated_at":"2017-07-05T15:46:04.089+08:00"},{"id":174119,"file_name":"black.png","project_id":7797,"asset_id":21159,"created_at":"2017-07-05T20:20:53.660+08:00","updated_at":"2017-07-05T20:20:53.660+08:00"},{"id":174677,"file_name":"block.png","project_id":7797,"asset_id":21219,"created_at":"2017-07-12T12:59:13.365+08:00","updated_at":"2017-07-12T12:59:13.365+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦