{"id":216714,"student_id":10,"content":"Game.set({width: 1200, height: 900})\n\n\nvar G = [[], [], [], []];\n\nfor (var x=0; x\u003c4; x++) {\n for (var y=0; y\u003c4; y++) {\n var b = createSprite('0.png','1.png','2.png','3.png','4.png','5.png','6.png','7.png','8.png','9.png','10.png','11.png')\n G[x][y] = b;\n b.x = x * 200 + 100\n b.y = y * 200 + 100\n } \n}\n\nfunction random() {\n var randX = Math.floor(Math.random()*4)\n var randY = Math.floor(Math.random()*4)\n G[randX][randY].costumeId = Math.floor(Math.random()*2) + 1\n}\n\n\nfunction moveUp(){\n move(G[0][0], G[0][1], G[0][2], G[0][3])\n move(G[1][0], G[1][1], G[1][2], G[1][3])\n move(G[2][0], G[2][1], G[2][2], G[2][3])\n move(G[3][0], G[3][1], G[3][2], G[3][3])\n random()\n}\n\nfunction moveDown(){\n move(G[0][3], G[0][2], G[0][1], G[0][0])\n move(G[1][3], G[1][2], G[1][1], G[1][0])\n move(G[2][3], G[2][2], G[2][1], G[2][0])\n move(G[3][3], G[3][2], G[3][1], G[3][0])\n random()\n}\n\nfunction moveRight(){\n move(G[0][0], G[1][0], G[2][0], G[3][0])\n move(G[0][1], G[1][1], G[2][1], G[3][1])\n move(G[0][2], G[1][2], G[2][2], G[3][2])\n move(G[0][3], G[1][3], G[2][3], G[3][3])\n random()\n}\n\nfunction moveLeft(){\n move(G[0][3], G[1][3], G[2][3], G[3][3])\n move(G[0][2], G[1][2], G[2][2], G[3][2])\n move(G[0][1], G[1][1], G[2][1], G[3][1])\n move(G[0][0], G[1][0], G[2][0], G[3][0])\n random()\n}\n\n\nfunction move(a, b, c, d) {\n let arr = [ a.costumeId, b.costumeId, c.costumeId, d.costumeId]\n for (let i=0; i\u003c3; i++) {\n if (arr[i] == arr[i + 1] \u0026\u0026 arr[i] != 0) {\n arr[i] += arr[i + 1];\n arr[i] = 0;\n }\n }\n let next = [0, 0, 0, 0];\n for (let i=0; i\u003c4; i++) {\n \n }\n}\n\n\non('keyup', 'up', moveUp)\non('keyup', 'right', moveRight)\non('keyup', 'left', moveLeft)\non('keyup', 'down', moveDown)\nrandom()\nrandom()","created_at":"2021-01-04T18:29:46.685+08:00","updated_at":"2021-03-24T17:11:32.080+08:00","name":"2048","language":"javascript","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/216714/847949839b06e02839bc2ac2a21180ad.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":192,"hashid":"p93sk4ww8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3816996,"file_name":"8.png","project_id":216714,"asset_id":302411,"created_at":"2021-01-04T18:30:18.097+08:00","updated_at":"2021-01-04T18:30:18.097+08:00"},{"id":3816997,"file_name":"9.png","project_id":216714,"asset_id":302412,"created_at":"2021-01-04T18:30:18.099+08:00","updated_at":"2021-01-04T18:30:18.099+08:00"},{"id":3816992,"file_name":"4.png","project_id":216714,"asset_id":302407,"created_at":"2021-01-04T18:30:17.035+08:00","updated_at":"2021-01-04T18:30:17.035+08:00"},{"id":3816993,"file_name":"5.png","project_id":216714,"asset_id":302408,"created_at":"2021-01-04T18:30:17.037+08:00","updated_at":"2021-01-04T18:30:17.037+08:00"},{"id":3816988,"file_name":"0.png","project_id":216714,"asset_id":302403,"created_at":"2021-01-04T18:30:16.018+08:00","updated_at":"2021-01-04T18:30:16.018+08:00"},{"id":3816989,"file_name":"1.png","project_id":216714,"asset_id":302404,"created_at":"2021-01-04T18:30:16.019+08:00","updated_at":"2021-01-04T18:30:16.019+08:00"},{"id":3816990,"file_name":"2.png","project_id":216714,"asset_id":302405,"created_at":"2021-01-04T18:30:16.523+08:00","updated_at":"2021-01-04T18:30:16.523+08:00"},{"id":3816991,"file_name":"3.png","project_id":216714,"asset_id":302406,"created_at":"2021-01-04T18:30:16.525+08:00","updated_at":"2021-01-04T18:30:16.525+08:00"},{"id":3816994,"file_name":"6.png","project_id":216714,"asset_id":302409,"created_at":"2021-01-04T18:30:17.588+08:00","updated_at":"2021-01-04T18:30:17.588+08:00"},{"id":3816995,"file_name":"7.png","project_id":216714,"asset_id":302410,"created_at":"2021-01-04T18:30:17.590+08:00","updated_at":"2021-01-04T18:30:17.590+08:00"},{"id":3817000,"file_name":"12.png","project_id":216714,"asset_id":302415,"created_at":"2021-01-04T18:30:19.120+08:00","updated_at":"2021-01-04T18:30:19.120+08:00"},{"id":3816998,"file_name":"10.png","project_id":216714,"asset_id":302413,"created_at":"2021-01-04T18:30:18.608+08:00","updated_at":"2021-01-04T18:30:18.608+08:00"},{"id":3816999,"file_name":"11.png","project_id":216714,"asset_id":302414,"created_at":"2021-01-04T18:30:18.610+08:00","updated_at":"2021-01-04T18:30:18.610+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦