{"id":26650,"student_id":10,"content":"// Lesson 1\nsetBackdrop(\"bg.jpg\");\nvar right = createSprite(\"success.png\");\nright.moveTo(280, 300);\nvar wrong = createSprite(\"error.png\");\nwrong.moveTo(360, 300);\nvar bomb = createSprite([\"bomb.png\",\"boom.png\"]);\nbomb.moveTo( 180, 60);\n\nvar score = 0;\n// End of Lesson 1\n// Lesson 5\nvar progressBar = 300;\n// Lesson 2\ncreateQ();\n\nforever(function(){\n print(\"Score: \" + score,280,360,\"#FF5151\",25); // Lesson 1\n // Lesson 5 加入這個 if-else 判斷式\n if(progressBar \u003e 0){\n print(num1 + \" + \" + num2 + \" = \", 240, 120, \"#8d6e63\", 40); // Lesson 2\n print(answer,300,180,\"#8d6e63\",40); // Lesson 2\n }else{\n gameOver();\n }\n // Lesson 5 把進度條畫出來\n progressBar-=2;\n pen.fillColor = \"#FF5151\";\n pen.size = 0;\n pen.drawRect(200,60,progressBar, 10);\n});\n// Lesson 3\nright.when(\"click\", function () {\n if(num1+num2 == answer){\n score += 1;\n createQ(); \n }else{\n // 遊戲結束\n gameOver(); // Lesson 3 加入“遊戲結束”的註解,Lesson 4 才call function\n } \n});\n\nwrong.when(\"click\", function () {\n if(num1+num2 != answer){\n score += 1;\n createQ();\n }else{\n // 遊戲結束\n gameOver(); // Lesson 3 加入“遊戲結束”的註解,Lesson 4 才call function\n }\n});\n// End of Lesson 3\n// Lesson 2\nfunction createQ(){\n num1 = Math.ceil(Math.random()*10);\n num2 = Math.ceil(Math.random()*10);\n if(Math.random() \u003c 0.3) {\n answer = num1 + num2;\n }else {\n answer = Math.floor(Math.random()*20);\n }\n progressBar = 300; // Lesson 5 才加入\n}\n// End of Lesson 2\n\n// Lesson 4\nfunction gameOver(){\n print(\"Game Over\",190,120,\"#8d6e63\",50);\n print(\"Score: \" + score,280,360,\"#FF5151\",25);\n bomb.costumeId = 1;\n stop();\n}\n// End of Lesson 4\n\n\n","created_at":"2018-04-20T12:36:44.942+08:00","updated_at":"2019-11-07T12:35:58.346+08:00","name":"算術炸彈(完整版)","language":"javascript","screenshot":{"url":null},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":286,"hashid":"2pdsrkw9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":492358,"file_name":"error.png","project_id":26650,"asset_id":60717,"created_at":"2018-04-20T12:36:54.922+08:00","updated_at":"2018-04-20T12:36:54.922+08:00"},{"id":492359,"file_name":"success.png","project_id":26650,"asset_id":60718,"created_at":"2018-04-20T12:36:54.930+08:00","updated_at":"2018-04-20T12:36:54.930+08:00"},{"id":492360,"file_name":"bg.jpg","project_id":26650,"asset_id":60719,"created_at":"2018-04-20T12:36:54.937+08:00","updated_at":"2018-04-20T12:36:54.937+08:00"},{"id":492361,"file_name":"boom.png","project_id":26650,"asset_id":60720,"created_at":"2018-04-20T12:36:54.945+08:00","updated_at":"2018-04-20T12:36:54.945+08:00"},{"id":492362,"file_name":"bomb.png","project_id":26650,"asset_id":60721,"created_at":"2018-04-20T12:36:54.962+08:00","updated_at":"2018-04-20T12:36:54.962+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦