{"id":716658,"student_id":10,"content":"from game import *\nfrom random import *\n\nset_backdrop('bg.png')\nimgs = [str(i) + '.png' for i in range(32)]\nnums = ['n' + str(i) + '.png' for i in range(10)]\nwhites = []\nflags = []\nstart = None\nactive = False\nclock = 0\n\nbgm = create_sound('bgm.ogg', True)\n\ntimer = []\nfor i in range(4):\n n1 = game.create_sprite(nums)\n n1.x = 240 * i + 240\n n1.opacity = 0.1\n n1.scale = 2\n timer.append(n1)\n\nfor x in range(16):\n for y in range(12):\n w = game.create_sprite('light.png')\n w.x = 37.5 + x * 75\n w.y = 37.5 + y * 75\n w.scale = 1.3\n w.hidden = True\n w.layer = -1\n whites.append(w)\n \nfor x in range(16 - 2):\n for y in range(12 - 2):\n f = create_sprite(imgs)\n f.costume_id = (y * 12 + x) // 2 % 32\n f.dx = 37.5 + x * 75 + 75\n f.dy = 37.5 + y * 75 + 75\n f.scale = 0.85\n f.rotation_style = 'fixed'\n flags.append(f)\n\ndef shuffle():\n for i in range(140):\n f1 = flags[i]\n f2 = flags[randint(0, 140 - 1)]\n if not f1.hidden and not f2.hidden:\n f1.dx, f2.dx = f2.dx, f1.dx\n f1.dy, f2.dy = f2.dy, f1.dy\n \ndef loop():\n global start, clock\n \n for w in whites:\n if start and abs(w.x - cursor.x) \u003c 30 and abs(w.y - cursor.y) \u003c 30:\n w.hidden = False\n if not start:\n w.hidden = True\n \n for f in flags:\n if start and f.touched(cursor) and f.costume_id != start.costume_id:\n start = None\n if f.distance_to(f.dx, f.dy) \u003e 10:\n f.toward(f.dx, f.dy)\n f.step_forward(10)\n else:\n f.move_to(f.dx, f.dy)\n \n clock += 1\n if clock % (60 * 30) == 0:\n shuffle()\n s = clock // 60\n timer[0].costume_id = (s // 60) // 10\n timer[1].costume_id = (s // 60) % 10\n timer[2].costume_id = (s % 60) // 10\n timer[3].costume_id = (s % 60) % 10\n \ndef mousedown():\n global start\n for f in flags:\n if f.touched(cursor):\n start = f\n\ncount = 0\n\ndef mouseup():\n global start, count\n for f in flags:\n if start and f.touched(cursor) and f.costume_id == start.costume_id and f is not start:\n f.hidden = True\n start.hidden = True\n count += 2\n start = None\n \n if count == 140:\n for n in timer: n.opacity = 0\n stop()\n\non('mousedown', mousedown)\non('mouseup', mouseup)\nforever(loop)\nshuffle()\n\n\n\n\n\n","created_at":"2024-03-21T12:37:19.488+08:00","updated_at":"2024-05-15T11:32:03.332+08:00","name":"方塊配對碰","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/716658/5bcc65920914c6c75df19ef4f092fd98.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":58,"hashid":"jzms9mwe3","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16029219,"file_name":"6.png","project_id":716658,"asset_id":729026,"created_at":"2024-03-21T12:38:25.831+08:00","updated_at":"2024-03-21T12:38:25.831+08:00"},{"id":16029220,"file_name":"7.png","project_id":716658,"asset_id":729027,"created_at":"2024-03-21T12:38:25.833+08:00","updated_at":"2024-03-21T12:38:25.833+08:00"},{"id":16029239,"file_name":"26.png","project_id":716658,"asset_id":729046,"created_at":"2024-03-21T12:38:30.604+08:00","updated_at":"2024-03-21T12:38:30.604+08:00"},{"id":16029240,"file_name":"27.png","project_id":716658,"asset_id":729047,"created_at":"2024-03-21T12:38:30.606+08:00","updated_at":"2024-03-21T12:38:30.606+08:00"},{"id":16029231,"file_name":"18.png","project_id":716658,"asset_id":729038,"created_at":"2024-03-21T12:38:28.416+08:00","updated_at":"2024-03-21T12:38:28.416+08:00"},{"id":16029232,"file_name":"19.png","project_id":716658,"asset_id":729039,"created_at":"2024-03-21T12:38:28.418+08:00","updated_at":"2024-03-21T12:38:28.418+08:00"},{"id":16029233,"file_name":"20.png","project_id":716658,"asset_id":729040,"created_at":"2024-03-21T12:38:28.807+08:00","updated_at":"2024-03-21T12:38:28.807+08:00"},{"id":16029234,"file_name":"21.png","project_id":716658,"asset_id":729041,"created_at":"2024-03-21T12:38:28.808+08:00","updated_at":"2024-03-21T12:38:28.808+08:00"},{"id":16029225,"file_name":"12.png","project_id":716658,"asset_id":729032,"created_at":"2024-03-21T12:38:27.132+08:00","updated_at":"2024-03-21T12:38:27.132+08:00"},{"id":16029226,"file_name":"13.png","project_id":716658,"asset_id":729033,"created_at":"2024-03-21T12:38:27.134+08:00","updated_at":"2024-03-21T12:38:27.134+08:00"},{"id":16029227,"file_name":"14.png","project_id":716658,"asset_id":729034,"created_at":"2024-03-21T12:38:27.571+08:00","updated_at":"2024-03-21T12:38:27.571+08:00"},{"id":16029228,"file_name":"15.png","project_id":716658,"asset_id":729035,"created_at":"2024-03-21T12:38:27.573+08:00","updated_at":"2024-03-21T12:38:27.573+08:00"},{"id":16029243,"file_name":"30.png","project_id":716658,"asset_id":729050,"created_at":"2024-03-21T12:38:31.518+08:00","updated_at":"2024-03-21T12:38:31.518+08:00"},{"id":16029244,"file_name":"31.png","project_id":716658,"asset_id":729051,"created_at":"2024-03-21T12:38:31.520+08:00","updated_at":"2024-03-21T12:38:31.520+08:00"},{"id":16029237,"file_name":"24.png","project_id":716658,"asset_id":729044,"created_at":"2024-03-21T12:38:30.162+08:00","updated_at":"2024-03-21T12:38:30.162+08:00"},{"id":16029238,"file_name":"25.png","project_id":716658,"asset_id":729045,"created_at":"2024-03-21T12:38:30.164+08:00","updated_at":"2024-03-21T12:38:30.164+08:00"},{"id":16029241,"file_name":"28.png","project_id":716658,"asset_id":729048,"created_at":"2024-03-21T12:38:31.030+08:00","updated_at":"2024-03-21T12:38:31.030+08:00"},{"id":16029242,"file_name":"29.png","project_id":716658,"asset_id":729049,"created_at":"2024-03-21T12:38:31.032+08:00","updated_at":"2024-03-21T12:38:31.032+08:00"},{"id":16029221,"file_name":"8.png","project_id":716658,"asset_id":729028,"created_at":"2024-03-21T12:38:26.285+08:00","updated_at":"2024-03-21T12:38:26.285+08:00"},{"id":16029222,"file_name":"9.png","project_id":716658,"asset_id":729029,"created_at":"2024-03-21T12:38:26.287+08:00","updated_at":"2024-03-21T12:38:26.287+08:00"},{"id":16029213,"file_name":"0.png","project_id":716658,"asset_id":729020,"created_at":"2024-03-21T12:38:24.474+08:00","updated_at":"2024-03-21T12:38:24.474+08:00"},{"id":16029214,"file_name":"1.png","project_id":716658,"asset_id":729021,"created_at":"2024-03-21T12:38:24.476+08:00","updated_at":"2024-03-21T12:38:24.476+08:00"},{"id":16029215,"file_name":"2.png","project_id":716658,"asset_id":729022,"created_at":"2024-03-21T12:38:24.991+08:00","updated_at":"2024-03-21T12:38:24.991+08:00"},{"id":16029216,"file_name":"3.png","project_id":716658,"asset_id":729023,"created_at":"2024-03-21T12:38:24.992+08:00","updated_at":"2024-03-21T12:38:24.992+08:00"},{"id":16029217,"file_name":"4.png","project_id":716658,"asset_id":729024,"created_at":"2024-03-21T12:38:25.433+08:00","updated_at":"2024-03-21T12:38:25.433+08:00"},{"id":16029218,"file_name":"5.png","project_id":716658,"asset_id":729025,"created_at":"2024-03-21T12:38:25.435+08:00","updated_at":"2024-03-21T12:38:25.435+08:00"},{"id":16029235,"file_name":"22.png","project_id":716658,"asset_id":729042,"created_at":"2024-03-21T12:38:29.711+08:00","updated_at":"2024-03-21T12:38:29.711+08:00"},{"id":16029236,"file_name":"23.png","project_id":716658,"asset_id":729043,"created_at":"2024-03-21T12:38:29.713+08:00","updated_at":"2024-03-21T12:38:29.713+08:00"},{"id":16029229,"file_name":"16.png","project_id":716658,"asset_id":729036,"created_at":"2024-03-21T12:38:28.002+08:00","updated_at":"2024-03-21T12:38:28.002+08:00"},{"id":16029230,"file_name":"17.png","project_id":716658,"asset_id":729037,"created_at":"2024-03-21T12:38:28.004+08:00","updated_at":"2024-03-21T12:38:28.004+08:00"},{"id":16029223,"file_name":"10.png","project_id":716658,"asset_id":729030,"created_at":"2024-03-21T12:38:26.733+08:00","updated_at":"2024-03-21T12:38:26.733+08:00"},{"id":16029224,"file_name":"11.png","project_id":716658,"asset_id":729031,"created_at":"2024-03-21T12:38:26.735+08:00","updated_at":"2024-03-21T12:38:26.735+08:00"},{"id":16441958,"file_name":"n1.png","project_id":716658,"asset_id":735990,"created_at":"2024-04-24T11:16:02.534+08:00","updated_at":"2024-04-24T11:16:02.534+08:00"},{"id":16441959,"file_name":"n0.png","project_id":716658,"asset_id":735991,"created_at":"2024-04-24T11:16:02.536+08:00","updated_at":"2024-04-24T11:16:02.536+08:00"},{"id":16441954,"file_name":"n5.png","project_id":716658,"asset_id":735986,"created_at":"2024-04-24T11:16:01.635+08:00","updated_at":"2024-04-24T11:16:01.635+08:00"},{"id":16441955,"file_name":"n4.png","project_id":716658,"asset_id":735987,"created_at":"2024-04-24T11:16:01.637+08:00","updated_at":"2024-04-24T11:16:01.637+08:00"},{"id":16442511,"file_name":"bg.png","project_id":716658,"asset_id":736006,"created_at":"2024-04-24T13:44:05.512+08:00","updated_at":"2024-04-24T13:44:05.512+08:00"},{"id":16441942,"file_name":"light.png","project_id":716658,"asset_id":735977,"created_at":"2024-04-24T10:58:01.672+08:00","updated_at":"2024-04-24T10:58:01.672+08:00"},{"id":16441952,"file_name":"n7.png","project_id":716658,"asset_id":735984,"created_at":"2024-04-24T11:16:01.250+08:00","updated_at":"2024-04-24T11:16:01.250+08:00"},{"id":16441953,"file_name":"n6.png","project_id":716658,"asset_id":735985,"created_at":"2024-04-24T11:16:01.251+08:00","updated_at":"2024-04-24T11:16:01.251+08:00"},{"id":16441950,"file_name":"n9.png","project_id":716658,"asset_id":735982,"created_at":"2024-04-24T11:16:00.831+08:00","updated_at":"2024-04-24T11:16:00.831+08:00"},{"id":16441951,"file_name":"n8.png","project_id":716658,"asset_id":735983,"created_at":"2024-04-24T11:16:00.833+08:00","updated_at":"2024-04-24T11:16:00.833+08:00"},{"id":16441956,"file_name":"n3.png","project_id":716658,"asset_id":735988,"created_at":"2024-04-24T11:16:02.027+08:00","updated_at":"2024-04-24T11:16:02.027+08:00"},{"id":16441957,"file_name":"n2.png","project_id":716658,"asset_id":735989,"created_at":"2024-04-24T11:16:02.028+08:00","updated_at":"2024-04-24T11:16:02.028+08:00"},{"id":16761125,"file_name":"bgm.ogg","project_id":716658,"asset_id":741754,"created_at":"2024-05-15T11:31:49.192+08:00","updated_at":"2024-05-15T11:31:49.192+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦