{"id":7939,"student_id":70,"content":"setBackdrop(\"darkslategrey\");\nvar state = \"level\";\nvar level = 1;\nvar score = 0;\nvar ans = [];\nvar i=0\n\n// 創造藍色方塊\nvar blueSquare = createSprite({\n costumes:[\"BlueSq.png\",\"BlueSqBright.png\"],\n x: 120,\n y: 120\n});\nblueSquare.colorId = 0;\nblueSquare.when(\"mousedown\", onclick);\nblueSquare.when(\"mouseup\", function () { this.scale = 1; });\n\n// 創造紅色方塊\nvar redSquare = createSprite({\n costumes:[\"RedSq.png\",\"RedSqBright.png\"],\n x: 340,\n y: 120\n});\nredSquare.colorId = 1;\nredSquare.when(\"mousedown\", onclick);\nredSquare.when(\"mouseup\", function () { this.scale = 1; });\n\n// 創造黃色方塊\nvar yellowSquare = createSprite({\n costumes:[\"YellowSq.png\",\"YellowSqBright.png\"],\n x: 120,\n y: 340\n});\nyellowSquare.colorId = 2;\nyellowSquare.when(\"mousedown\", onclick);\nyellowSquare.when(\"mouseup\", function () { this.scale = 1; });\n\n// 創造綠色方塊\nvar greenSquare = createSprite({\n costumes:[\"GreenSq.png\",\"GreenSqBright.png\"],\n x: 340,\n y: 340\n});\ngreenSquare.colorId = 3;\ngreenSquare.when(\"mousedown\", onclick);\ngreenSquare.when(\"mouseup\", function () { this.scale = 1; });\n\n// 定義點擊 callback\nfunction onclick(){\n if(state!=\"input\"){ return; }\n this.scale = 0.9;\n if(this.colorId==ans[i]){\n score++;\n i++;\n } else {\n state = \"gameover\";\n }\n if(i\u003e=level){\n state=\"level\";\n level++;\n i=0;\n ans = [];\n }\n}\n\nsetInterval(function(){\n if(i\u003e=level){\n state = \"input\";\n i=0;\n }\n if(state==\"level\"){\n var colorId = Math.floor(Math.random()*4)\n ans.push( colorId );\n if(colorId==0){\n blueSquare.costumeId=1;\n } else if (colorId==1){\n redSquare.costumeId=1;\n } else if (colorId==2){\n yellowSquare.costumeId=1;\n } else if (colorId==3){\n greenSquare.costumeId=1;\n }\n setTimeout(function(){\n blueSquare.costumeId = 0;\n redSquare.costumeId = 0;\n yellowSquare.costumeId = 0;\n greenSquare.costumeId = 0;\n },400);\n i++;\n }\n},800);\n\nforever(function(){\n print(score, 490, 10, \"white\", 35);\n print(\"Level \" + level, 490, 50, \"white\", 35);\n if(state==\"gameover\"){\n print(\"Game Over, Score: \" + score, 100, 50, \"red\", 50);\n stop();\n }\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-08T06:52:22.485+08:00","name":"Simon Memory Game","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/7939/62718b637554959b48aa694bb7171513.jpg"},"parent_id":7932,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":362,"hashid":"meysd4w","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":175252,"file_name":"BlueSq.png","project_id":7939,"asset_id":21365,"created_at":"2017-07-18T19:53:34.630+08:00","updated_at":"2017-07-18T19:53:34.630+08:00"},{"id":175253,"file_name":"BlueSqBright.png","project_id":7939,"asset_id":21361,"created_at":"2017-07-18T19:53:34.633+08:00","updated_at":"2017-07-18T19:53:34.633+08:00"},{"id":175254,"file_name":"GreenSq.png","project_id":7939,"asset_id":21366,"created_at":"2017-07-18T19:53:34.635+08:00","updated_at":"2017-07-18T19:53:34.635+08:00"},{"id":175255,"file_name":"GreenSqBright.png","project_id":7939,"asset_id":21362,"created_at":"2017-07-18T19:53:34.637+08:00","updated_at":"2017-07-18T19:53:34.637+08:00"},{"id":175256,"file_name":"RedSq.png","project_id":7939,"asset_id":21367,"created_at":"2017-07-18T19:53:34.639+08:00","updated_at":"2017-07-18T19:53:34.639+08:00"},{"id":175257,"file_name":"RedSqBright.png","project_id":7939,"asset_id":21363,"created_at":"2017-07-18T19:53:34.641+08:00","updated_at":"2017-07-18T19:53:34.641+08:00"},{"id":175258,"file_name":"YellowSq.png","project_id":7939,"asset_id":21368,"created_at":"2017-07-18T19:53:34.643+08:00","updated_at":"2017-07-18T19:53:34.643+08:00"},{"id":175259,"file_name":"YellowSqBright.png","project_id":7939,"asset_id":21364,"created_at":"2017-07-18T19:53:34.645+08:00","updated_at":"2017-07-18T19:53:34.645+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦