{"id":9209,"student_id":70,"content":"var sheeps = [];\nvar grass = [];\nfor(var i=0; i\u003c30; i++){\n var sheep = new Sheep();\n sheep.forever(function(){\n if(this.state==\"walk\"){\n this.stateCount++;\n this.costumeId = Math.floor(this.stateCount/10)%4;\n this.toward(this.destination);\n this.stepForward(0.8);\n if(this.distanceTo(this.destination)\u003c0.8 || (this.touched(sheeps)\u0026\u0026this.stateCount\u003e40)){\n this.state=\"idle\";\n this.stateCount = 0;\n }\n } else if (this.state==\"idle\"){\n this.stateCount++;\n if(this.stateCount\u003e100+Math.random()*300){\n this.destination.x = Math.random()*640;\n this.destination.y = Math.random()*480;\n this.state=\"walk\";\n this.stateCount = 0;\n }\n }\n });\n sheeps.push( sheep );\n}\nfor(var i=0;i\u003c1000;i++){\n var g = createSprite(\"grass.png\");\n g.x = Math.random()*640;\n g.y = Math.random()*480;\n g.layer = -1;\n grass.push( g );\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-02T22:25:32.981+08:00","name":"羊羊牧場","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/9209/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":2,"plugin":"function Sheep(){\r\n Sprite.call(this,[\"sheep_walk_01.png\",\"sheep_walk_02.png\",\"sheep_walk_03.png\",\"sheep_walk_04.png\"]);\r\n this.x = Math.random()*640;\r\n this.y = Math.random()*480;\r\n this.hungry = 0;\r\n this.state = \"walk\";\r\n this.direction=90;\r\n this.rotationStyle=\"flipped\";\r\n this.destination = {x:Math.random()*640, y:Math.random()*480};\r\n this.stateCount = 0;\r\n this.forever(function(){\r\n this.hungry+=0.1;\r\n if(this.hungry\u003e=100){\r\n this.state=\"dead\";\r\n }\r\n this.layer = Math.floor(this.y);\r\n });\r\n}\r\nSheep.prototype = Sprite.prototype;\r\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":407,"hashid":"vngs3k8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":203097,"file_name":"sheep_walk_01.png","project_id":9209,"asset_id":24446,"created_at":"2017-08-12T15:28:16.027+08:00","updated_at":"2017-08-12T15:28:16.027+08:00"},{"id":203098,"file_name":"sheep_walk_02.png","project_id":9209,"asset_id":24447,"created_at":"2017-08-12T15:28:16.029+08:00","updated_at":"2017-08-12T15:28:16.029+08:00"},{"id":203099,"file_name":"sheep_walk_03.png","project_id":9209,"asset_id":24448,"created_at":"2017-08-12T15:28:16.031+08:00","updated_at":"2017-08-12T15:28:16.031+08:00"},{"id":203100,"file_name":"sheep_walk_04.png","project_id":9209,"asset_id":24449,"created_at":"2017-08-12T15:28:16.033+08:00","updated_at":"2017-08-12T15:28:16.033+08:00"},{"id":203101,"file_name":"grass.png","project_id":9209,"asset_id":24450,"created_at":"2017-08-12T15:28:16.035+08:00","updated_at":"2017-08-12T15:28:16.035+08:00"},{"id":203453,"file_name":"tombstone.png","project_id":9209,"asset_id":24458,"created_at":"2017-08-12T16:41:21.901+08:00","updated_at":"2017-08-12T16:41:21.901+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦