{"id":169449,"student_id":12205,"content":"setBackdrop(\"blue\");\nvar me = createSprite(\"me.jpg\");\nvar ground = createSprite(\"ground.jpg\");\nground.y = 464;\nme.y = 428;\nvar score = 0;\n\nwhen(\"holding\",\"left\",function(){\n\tme.x-=6;\n if(me.x \u003c me.width/2){\n \tme.x = me.width/2;\n }\n});\nwhen(\"holding\",\"right\",function(){\n\tme.x+=6;\n if(me.x \u003e 640-me.width/2){\n \tme.x = 640-me.width/2;\n }\n});\n\nforever(function(){\n\tprint(score);\n});\n\nsetInterval(function(){\n\tvar square = createSprite(\"square.jpg\");\n square.y=-80;\n square.x=Math.random()*640;\n square.when(\"touch\",me,function(){\n \tstop();\n });\n square.when(\"touch\",ground,function(){\n \tthis.destroy();\n });\n square.forever(function(){\n \tthis.y+=8;\n });\n score++;\n},250);\n\nsetBackdrop(\"black\");\n\nvar lights = [];\nfor(var i = 0;i\u003c15;i++) {\n var light = {\n x:cursor.x,\n y:cursor.y,\n color:\"rgb(\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\")\",\n vx:Math.random() *8 - 4,\n vy:Math.random() *8 - 4,\n r:Math.random() * 6\n };\n lights.push(light);\n};\n\nforever(function(){\n for(var i=0;i\u003clights.length;i++) {\n var light = lights[i];\n light.x +=light.vx;\n light.y +=light.vy;\n light.vy +=0.1\n light.r *=0.99\n pen.size = 0;\n pen.fillColor = light.color;\n if(light.r\u003e1) {\n pen.drawCircle(light.x,light.y,light.r);\n };\n }\n for(var i = 0;i\u003c15;i++) {\n var light = {\n x:cursor.x,\n y:cursor.y,\n color:\"rgb(\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\",\"+Math.floor(Math.random()*255)+\")\",\n vx:Math.random() *8 - 4,\n vy:Math.random() *8 - 4,\n r:Math.random() * 6\n };\n lights.push(light);\n };\n \n});","created_at":"2020-07-22T16:17:33.847+08:00","updated_at":"2020-07-23T15:27:34.778+08:00","name":"躲避方塊 Js.","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/169449/a51c40c5dc06986f1b0d9ba7ac0e4d06.jpg"},"parent_id":5705,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":41,"hashid":"zpeswq3d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2928778,"file_name":"ground.jpg","project_id":169449,"asset_id":16741,"created_at":"2020-07-22T16:17:33.854+08:00","updated_at":"2020-07-22T16:17:33.854+08:00"},{"id":2928779,"file_name":"me.jpg","project_id":169449,"asset_id":16742,"created_at":"2020-07-22T16:17:33.857+08:00","updated_at":"2020-07-22T16:17:33.857+08:00"},{"id":2928780,"file_name":"square.jpg","project_id":169449,"asset_id":16743,"created_at":"2020-07-22T16:17:33.859+08:00","updated_at":"2020-07-22T16:17:33.859+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦