{"id":66491,"student_id":10,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n\\t\u003cscript src=\\\"https://code.jquery.com/jquery-3.4.1.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003cimg src=\\\"koding.png\\\" alt=\\\"\\\"\u003e\\n \u003cbr/\u003e\\n \u003cbutton id=\\\"eat\\\"\u003e餵食\u003c/button\u003e\\n \u003cbutton id=\\\"play\\\"\u003e玩遊戲\u003c/button\u003e\\n \u003cbutton id=\\\"clear\\\"\u003e打掃\u003c/button\u003e\\n \u003cbutton id=\\\"light\\\"\u003e開/關燈\u003c/button\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"\\nbody {\\n text-align: center;\\n padding: 30px;\\n}\\n\\nimg { \\n max-width: 50%; \\n}\\n\",\"js\":\"var startTime = localStorage.getItem('startTime');\\nvar updateTime = localStorage.getItem('updateTime');\\n\\nif (startTime == undefined) {\\n localStorage.setItem('hungry', 50);\\n localStorage.setItem('happy', 70);\\n localStorage.setItem('dirty', 0);\\n localStorage.setItem('heath', 100);\\n alert('小雞誕生');\\n}\\n\\nvar passTime = (Date.now() - updateTime)/1000;\\nlocalStorage.setItem('updateTime', Date.now());\\n\\nvar hungry = localStorage.setItem('hungry', 50);\\nvar happy = localStorage.setItem('happy', 70);\\nvar dirty = localStorage.setItem('dirty', 0);\\nvar heath = localStorage.setItem('heath', 100);\\n\\n// 環境隨時間變髒\\ndirty += passTime*0.0001;\\nif (dirty \u003e 100) dirty = 100;\\n\\n// 飢餓\\nhungry -= passTime*0.01;\\nif (hungry \u003c 0) hungry = 0;\\n\\n// 隨時間增加開心程度降低\\nhappy -= passTime*0.01;\\n\\n\\nlocalStorage.setItem('hungry', hungry);\\nlocalStorage.setItem('happy', happy);\\nlocalStorage.setItem('dirty', dirty);\\nlocalStorage.setItem('heath', heath);\\n\\nif (hungry == 0 || heath == 0 || happy == 0) {\\n alert('小雞死亡');\\n}\\n\\n\\nfunction eat () {\\n if (hungry \u003c 80) {\\n hungry += Math.random()*20;\\n } else {\\n alert('吃飽了');\\n }\\n}\\n\\nfunction play () {\\n if (happy \u003c 80) {\\n happy += Math.random()*20;\\n } else {\\n alert('不想玩了');\\n }\\n}\\n\\nfunction clear () {\\n dirty = 0;\\n localStorage.setItem('dirty', 0);\\n}\\n\\nfunction toggleLight () {\\n var color = $('body').css('backgroundColor');\\n $('body').css('backgroundColor', color == 'black' ? 'white' : 'black');\\n}\\n\\n$('#eat').click(eat);\\n$('#play').click(play);\\n$('#clear').click(clear);\\n$('#light').click(toggleLight);\"}","created_at":"2019-05-07T17:43:21.664+08:00","updated_at":"2019-11-10T12:44:40.352+08:00","name":"電子寵物","language":"web","screenshot":{"url":"/uploads/project/screenshot/66491/069a9e951ab695fb9be97f17a080d91d.jpg"},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":505,"hashid":"d5msgneq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1161028,"file_name":"koding.png","project_id":66491,"asset_id":107444,"created_at":"2019-05-07T17:43:21.669+08:00","updated_at":"2019-05-07T17:43:21.669+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
Open Web Site
繁中
简中
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