{"id":33039,"student_id":173,"content":"setBackdrop(\"#000000\");\n\nvar head = createSprite(\"head.gif\");\nvar bodies = []\nvar food = createSprite(\"food.gif\")\nfood.x = Math.random()*640\nfood.y = Math.random()*480\nvar score = 0\nvar clock = 0\nforever(function() {\n if (clock%8 == 0) {\n var lastBody = bodies.pop()\n if(lastBody){\n lastBody.x = head.x\n lastBody.y = head.y\n bodies.unshift(lastBody)\n }\n head.stepForward(16)\n if(head.touched(bodies)||head.x\u003c0||head.x\u003e640||head.y\u003c0||head.y\u003e480){\n print(\"GAME OVER\", 160,200,\"white\",64)\n stop()\n }\n if (head.touched(food)) {\n score += 1\n food.x = Math.random()*640\n food.y = Math.random()*480\n var body = createSprite(\"body.gif\")\n body.x = head.x\n body.y = head.y\n bodies.push(body)\n \n }\n }\n clock = clock += 1\n print(score, 20, 20, \"white\")\n\n});\n\n\nwhen(\"keydown\", \"right\", function() {\n head.direction = 90;\n});\nwhen(\"keydown\", \"left\", function() {\n head.direction = 270;\n});\nwhen(\"keydown\", \"up\", function() {\n head.direction = 0;\n});\nwhen(\"keydown\", \"down\", function() {\n head.direction = 180;\n});","created_at":"2018-06-30T21:13:25.463+08:00","updated_at":"2019-11-09T18:18:18.056+08:00","name":"貪食蛇 學生版","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/33039/053e20ceb4bc008fdcebe7eec30ae36c.jpg"},"parent_id":4697,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":93,"hashid":"d5msnk56","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":616029,"file_name":"head.gif","project_id":33039,"asset_id":15651,"created_at":"2018-06-30T21:13:25.470+08:00","updated_at":"2018-06-30T21:13:25.470+08:00"},{"id":616030,"file_name":"body.gif","project_id":33039,"asset_id":15652,"created_at":"2018-06-30T21:13:25.472+08:00","updated_at":"2018-06-30T21:13:25.472+08:00"},{"id":616031,"file_name":"food.gif","project_id":33039,"asset_id":15653,"created_at":"2018-06-30T21:13:25.475+08:00","updated_at":"2018-06-30T21:13:25.475+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦