{"id":10670,"student_id":281,"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 = 10;\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":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-10-25T03:50:35.404+08:00","name":"算術炸彈(完整版)","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/10670/edd4f1f4905577a4a0691575ea272d0e.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":254,"hashid":"wdks4wm5","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":236723,"file_name":"error.png","project_id":10670,"asset_id":28675,"created_at":"2017-09-03T13:29:12.685+08:00","updated_at":"2017-09-03T13:29:12.685+08:00"},{"id":236724,"file_name":"success.png","project_id":10670,"asset_id":28676,"created_at":"2017-09-03T13:29:12.687+08:00","updated_at":"2017-09-03T13:29:12.687+08:00"},{"id":236725,"file_name":"bg.jpg","project_id":10670,"asset_id":28677,"created_at":"2017-09-03T13:29:12.688+08:00","updated_at":"2017-09-03T13:29:12.688+08:00"},{"id":236726,"file_name":"boom.png","project_id":10670,"asset_id":28678,"created_at":"2017-09-03T13:29:12.689+08:00","updated_at":"2017-09-03T13:29:12.689+08:00"},{"id":236727,"file_name":"bomb.png","project_id":10670,"asset_id":28679,"created_at":"2017-09-03T13:29:12.691+08:00","updated_at":"2017-09-03T13:29:12.691+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦