{"id":206823,"student_id":10,"content":"from game import *\nfrom random import *\n\ngame.set_backdrop('bg_3.png')\n\n# food = create_sprite('food.png')\n\np1_head = create_sprite('red.png')\np1_body = [create_sprite('red.png')]\np1_gameover = False\n\nclock = 0\n\nfoods = []\n\nfor i in range(100):\n f = create_sprite('food.png')\n f.x = randrange(100, 1100)\n f.y = randrange(100, 800)\n foods.append(f)\n \ndef loop():\n global p1_body, p1_gameover, clock\n \n clock += 1\n \n # if clock % 10 == 0:\n # f = create_sprite('food.png')\n # f.x = randrange(100, 1100)\n # f.y = randrange(100, 800)\n # foods.append(f)\n \n if key.left: p1_head.direction -= 3\n if key.right: p1_head.direction += 3\n \n if p1_head.x \u003e 1200: p1_head.x -= 1200\n if p1_head.x \u003c 0: p1_head.x += 1200\n if p1_head.y \u003e 900: p1_head.y -= 900\n if p1_head.y \u003c 0: p1_head.y += 900\n \n if clock % 5 == 0 and p1_gameover == False:\n b = p1_body.pop()\n b.layer = clock\n b.move_to(p1_head)\n b.direction = p1_head.direction\n p1_body = [b] + p1_body\n \n if key.up:\n p1_head.step_forward(30)\n else:\n p1_head.step_forward(15)\n\n \n # if p1_head.touched(food):\n # food.x = randrange(100, 1100)\n # food.y = randrange(100, 800)\n # b = create_sprite('red.png')\n # b.move_to(p1_head)\n # p1_body.append(b)\n \ndef touch_food(f):\n p1_body.append(f)\n\nforever(loop)\n\np1_head.on('touch', foods, touch_food)\n\n","created_at":"2020-11-26T23:54:07.595+08:00","updated_at":"2020-11-27T00:10:13.699+08:00","name":"絕食蛇","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/206823/c6371d3eb88803ab49f20e282f8b404b.jpg"},"parent_id":202940,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":201,"hashid":"npms33rm8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3592337,"file_name":"blue.png","project_id":206823,"asset_id":280307,"created_at":"2020-11-26T23:54:07.608+08:00","updated_at":"2020-11-26T23:54:07.608+08:00"},{"id":3592330,"file_name":"bg_4.png","project_id":206823,"asset_id":280635,"created_at":"2020-11-26T23:54:07.600+08:00","updated_at":"2020-11-26T23:54:07.600+08:00"},{"id":3592331,"file_name":"bg_3.png","project_id":206823,"asset_id":280634,"created_at":"2020-11-26T23:54:07.602+08:00","updated_at":"2020-11-26T23:54:07.602+08:00"},{"id":3592332,"file_name":"bg_2.png","project_id":206823,"asset_id":280633,"created_at":"2020-11-26T23:54:07.603+08:00","updated_at":"2020-11-26T23:54:07.603+08:00"},{"id":3592333,"file_name":"bg_1.png","project_id":206823,"asset_id":280632,"created_at":"2020-11-26T23:54:07.604+08:00","updated_at":"2020-11-26T23:54:07.604+08:00"},{"id":3592334,"file_name":"food.png","project_id":206823,"asset_id":280310,"created_at":"2020-11-26T23:54:07.605+08:00","updated_at":"2020-11-26T23:54:07.605+08:00"},{"id":3592335,"file_name":"red.png","project_id":206823,"asset_id":280309,"created_at":"2020-11-26T23:54:07.606+08:00","updated_at":"2020-11-26T23:54:07.606+08:00"},{"id":3592336,"file_name":"green.png","project_id":206823,"asset_id":280308,"created_at":"2020-11-26T23:54:07.607+08:00","updated_at":"2020-11-26T23:54:07.607+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦