{"id":16618,"student_id":10,"content":"setBackdrop(\"rgb(36, 113, 199)\");\nvar width = 2;\nvar levels = 1;\nvar status = 0; \nvar cubes = [];\n\nfunction startGame () {\n \n status = 0;\n\n for (var i=0; i\u003ccubes.length; i++) {\n cubes[i].destroy();\n }\n cubes = [];\n\n for (var x=0; x\u003cwidth; x++) {\n for (var y=0; y\u003cwidth; y++) {\n var c = createSprite(\"cube.png\");\n c.x = 120 + 200/width + x * 400/width;\n c.y = 40 + 200/width + y * 400/width;\n c.scale = 1/width;\n c.opacity = 0.2;\n c.right = false;\n c.on('click', function () {\n if (status == 1) {\n if (this.right) {\n this.opacity = 1;\n } else {\n this.scale = 0.8/width;\n }\n }\n });\n cubes.push(c);\n }\n }\n\n var i = 0;\n while(i\u003clevels) {\n var index = Math.floor(Math.random()*cubes.length);\n var cube = cubes[index];\n if (cube.right == false) {\n cube.right = true;\n cube.opacity = 1;\n cube.forever(function () {\n if (status == 0 \u0026\u0026 this.opacity \u003e 0.2) {\n this.opacity -= 0.004;\n }\n if (this.opacity \u003c 0.2) {\n status = 1;\n }\n });\n i++;\n }\n }\n}\n\nforever(function(){\n var fail = 0;\n var count = 0;\n for (var i=0; i\u003ccubes.length; i++) {\n if (cubes[i].opacity == 1) {\n count++;\n }\n if (cubes[i].scale \u003c 1/width) {\n fail++;\n }\n }\n \n if (fail \u003e 3) {\n print('Level: ' + levels, 10, 10, '#fff', 25);\n stop();\n }\n if (count == levels \u0026\u0026 status == 1) {\n status = 2;\n setTimeout(function () {\n levels++;\n if (levels/(width*width) \u003e 0.333) {\n width++;\n }\n startGame();\n }, 1000);\n }\n\n print('Level: ' + levels, 10, 10, '#fff', 25);\n print('Fail: ' + fail, 10, 40, '#fff', 25);\n print('count: ' + count, 10, 70, '#fff', 25);\n});\n\nstartGame();","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-11T02:27:33.087+08:00","name":"cubes memory","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/16618/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":656,"hashid":"d5msvepg","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":341984,"file_name":"cube.png","project_id":16618,"asset_id":39916,"created_at":"2017-11-30T00:21:14.711+08:00","updated_at":"2017-11-30T00:21:14.711+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