{"id":28322,"student_id":3469,"content":"var heroName = \"蘋果\";\nvar heroHP = 1;\nvar heroMP = 1;\n/*function drink() {\n console.log(\"準備喝下藥水...\");\n}\ndrink();*/\ndrink( mixPotions(\"紅藥水\", \"藍藥水\") );\nfunction drink(potion){\n console.log(\"準備喝下藥水...\");\n if(potion===\"紅藥水\"){\n heroHP = heroHP+40;\n } else if(potion===\"藍藥水\") {\n heroMP = heroMP+40;\n } else if(potion===\"紫藥水\") {\n heroHP = heroHP+40;\n heroMP = heroMP+40;\n }\n if(heroHP\u003e100){\n heroHP=100;\n }\n if(heroMP\u003e100){\n heroMP=100;\n }\n}\n/*function mixPotions ( potion1, potion2 ) {\n var newPotion = \"水\";\n if(potion1===\"紅藥水\" \u0026\u0026 potion2===\"藍藥水\"){\n newPotion = \"紫藥水\";\n } else if(potion1===\"紅藥水\" \u0026\u0026 potion2===\"紅藥水\"){\n newPotion = \"大紅藥水\";\n } else if(potion1===\"藍藥水\" \u0026\u0026 potion2===\"紅藥水\"){\n newPotion = \"紫藥水\";\n } else if(potion1===\"藍藥水\" \u0026\u0026 potion2===\"藍藥水\"){\n newPotion = \"大藍藥水\";\n }\n console.log(\"成功做出了: \"+newPotion);\n}*/\nfunction mixPotions ( potion1, potion2 ) {\n var newPotion = \"水\";\n if(potion1===\"紅藥水\" \u0026\u0026 potion2===\"藍藥水\"){\n newPotion=\"紫藥水\";\n } else if(potion1===\"紅藥水\" \u0026\u0026 potion2===\"紅藥水\"){\n newPotion===\"大紅藥水\";\n } else if(potion1===\"藍藥水\" \u0026\u0026 potion2===\"紅藥水\"){\n newPotion===\"紫藥水\";\n } else if(potion1===\"藍藥水\" \u0026\u0026 potion2===\"藍藥水\"){\n newPotion===\"大藍藥水\";\n }\n console.log(\"成功做出了: \"+newPotion);\n return newPotion;\n}","created_at":"2018-05-10T22:08:33.691+08:00","updated_at":"2020-08-16T17:08:41.832+08:00","name":"JS Game L4","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/28322/5a80df4ba0b10058217259b885db6c71.jpg"},"parent_id":4708,"plugin":"setBackdrop(\"#5ea642\");\nvar hero = createSprite(\"hero.png\");\nvar box = createSprite(\"console-box.png\");\nhero.scale = 0.2;\nbox.y=380;\n\nvar heroName = heroName || \"請輸入主角名稱\";\nvar heroHP = heroHP || 0;\nvar heroMP = heroMP || 0;\nvar heroStatus = heroStatus || \"\";\n\nvar originConsoleLog = console.log;\nvar logs = [];\nconsole.log = function(log){\n\tlogs.push(log);\n if(logs.length\u003e5){logs.shift();}\n originConsoleLog(log);\n};\n\nforever(function(){\n\tprint(heroName, 20, 20, \"white\", 18);\n\tprint(\"生命: \" + heroHP, 20, 48);\n\tprint(\"魔力: \" + heroMP, 20, 68);\n\tprint(\"狀態: \" + heroStatus, 20, 88);\n for(var i=logs.length-1;i\u003e=0;i--){\n\t print(logs[i], 64, 330+20*i, \"white\",14); \n }\n});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":141,"hashid":"jzms9ezm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":522204,"file_name":"hero.png","project_id":28322,"asset_id":15669,"created_at":"2018-05-10T22:08:33.697+08:00","updated_at":"2018-05-10T22:08:33.697+08:00"},{"id":522205,"file_name":"console-box.png","project_id":28322,"asset_id":15670,"created_at":"2018-05-10T22:08:33.699+08:00","updated_at":"2018-05-10T22:08:33.699+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦