{"id":694904,"student_id":10,"content":"from game import *\nfrom random import random, randint\n\nset_backdrop('bg.png')\n\nscroll = 0\nwindows = []\npeople = []\n\nfor x in range(2):\n for y in range(4):\n p = create_sprite('c.png', 'c.png', 'c.png')\n p.x = 300 + randint(0, 3) * 200\n p.y = 100 + y * 200\n if x == 0: p.direction = 270\n p.clock = 0\n p.target = None\n p.speed = 2 + random() * 2\n people.append(p)\n\ncover = create_sprite('cover.png')\n\nfor x in range(4):\n for y in range(4):\n w = create_sprite('w0.png', 'w1.png', 'w2.png')\n w.x = 300 + x * 200\n w.y = 100 + y * 200\n windows.append(w)\n \nplayer = create_sprite('c.png')\nplayer.x = 100 + 800\nplayer.y = 100\n \ndef loop():\n global scroll\n for p in people:\n update_people(p)\n if p.costume_id == 2 and p.touched(player):\n stop()\n \n\ndef update_people(c):\n c.clock -= 1\n if c.clock \u003c 0:\n c.step_forward(c.speed)\n for w in windows:\n if c.distance_to(w) \u003c 10 and w.costume_id != 2 and random() \u003c 0.05:\n c.clock = 100 if random() \u003e 0.5 else 49\n c.target = w\n\n if c.x \u003c 290 or c.x \u003e 910:\n c.direction += 180\n if c.clock == 50:\n c.costume_id = 2\n c.target.costume_id = 2\n if c.clock == 0:\n c.costume_id = 0\n c.target.costume_id = 0\n \ndef wipe():\n global scroll\n count = 0\n for w in windows:\n if w.touched(player) and w.opacity \u003e 0.5:\n w.opacity -= 0.1\n if w.opacity \u003c= 0.5:\n count += 1\n if count == 16:\n scroll = 900\n \ndef moveup():\n if player.y \u003e 100: player.y -= 200\n\ndef movedown():\n if player.y \u003c 700: player.y += 200\n\ndef moveleft():\n if player.x \u003e 300: player.x -= 200\n\ndef moveright():\n if player.x \u003c 900: player.x += 200\n\non('keydown', 'up', moveup)\non('keydown', 'down', movedown)\non('keydown', 'left', moveleft)\non('keydown', 'right', moveright)\non('keydown', 'space', wipe)\nforever(loop)\n\n\n","created_at":"2024-02-15T18:30:47.017+08:00","updated_at":"2024-05-30T16:29:59.518+08:00","name":"洗窗工人","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/694904/d7f72eb85f77b49e3fb4f79f33aa33bb.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":58,"hashid":"2pdsye26j","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":15565819,"file_name":"c.png","project_id":694904,"asset_id":721113,"created_at":"2024-02-15T18:31:31.838+08:00","updated_at":"2024-02-15T18:31:31.838+08:00"},{"id":15565820,"file_name":"w1.png","project_id":694904,"asset_id":721114,"created_at":"2024-02-15T18:31:31.841+08:00","updated_at":"2024-02-15T18:31:31.841+08:00"},{"id":16025873,"file_name":"cover.png","project_id":694904,"asset_id":728980,"created_at":"2024-03-20T19:09:44.032+08:00","updated_at":"2024-03-20T19:09:44.032+08:00"},{"id":16025872,"file_name":"bg.png","project_id":694904,"asset_id":728979,"created_at":"2024-03-20T19:09:39.756+08:00","updated_at":"2024-03-20T19:09:39.756+08:00"},{"id":16026027,"file_name":"w2.png","project_id":694904,"asset_id":728981,"created_at":"2024-03-20T19:11:42.758+08:00","updated_at":"2024-03-20T19:11:42.758+08:00"},{"id":16026028,"file_name":"w0.png","project_id":694904,"asset_id":728982,"created_at":"2024-03-20T19:11:42.760+08:00","updated_at":"2024-03-20T19:11:42.760+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦