{"id":765920,"student_id":10,"content":"from game import *\nfrom random import *\n\n\nset_backdrop('#0C61A9')\n\nkeys = ['forever', 'def', 'set', 'backdrop', 'loop', 'from', 'import', 'apple']\nwords = [{'text': 'apple', 'answer': '', 'x': 600, 'y': 0 }]\nbullets = []\nfocus = None\nclock = 0\n\n\ntarget = create_sprite('target.png')\nship = create_sprite('ship.png')\nship.y = 800\n\ndef loop():\n global words, clock\n clock += 1\n \n if clock % 120 == 0:\n words.append({\n 'text': keys[randrange(len(keys))],\n 'answer': '',\n 'x': 200 + random() * 800,\n 'y': 0\n })\n \n for w in words:\n draw_text(w['text'], w['x'], w['y'], 'white', 40)\n draw_text(w['answer'], w['x'], w['y'], 'orange', 40)\n w['y'] += 1\n \n words = [word for word in words if word['text'] != word['answer']]\n \n if focus:\n target.x = focus['x']\n target.y = focus['y'] + 30\n \n ship.toward(target)\n \n for b in bullets:\n b.toward(target)\n b.step_forward(40)\n if b.touched(target): b.destroy()\n\ndef keydown():\n global focus\n \n k = ''\n for i in 'abcdefghijklmnopqrstuvwxyz':\n if key[i]: k = i\n \n if focus == None:\n for w in words:\n if w['text'][0] == k: focus = w\n \n if focus and focus['text'][len(focus['answer'])] == k:\n focus['answer'] += k\n if focus['answer'] == focus['text']: focus = None\n b = create_sprite('bullet.png')\n b.move_to(ship)\n bullets.append(b)\n \n\non('keydown', keydown)\nforever(loop)\n\n","created_at":"2024-06-06T14:22:20.675+08:00","updated_at":"2024-06-06T16:02:15.325+08:00","name":"打字遊戲","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/765920/097a117c3c2be2ebcd628b114d2559cf.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":50,"hashid":"6rpsqvw5n","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17096615,"file_name":"target.png","project_id":765920,"asset_id":746707,"created_at":"2024-06-06T15:33:16.101+08:00","updated_at":"2024-06-06T15:33:16.101+08:00"},{"id":17096616,"file_name":"ship.png","project_id":765920,"asset_id":746708,"created_at":"2024-06-06T15:45:42.452+08:00","updated_at":"2024-06-06T15:45:42.452+08:00"},{"id":17096617,"file_name":"bullet.png","project_id":765920,"asset_id":746709,"created_at":"2024-06-06T15:45:45.720+08:00","updated_at":"2024-06-06T15:45:45.720+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦