{"id":765530,"student_id":10,"content":"from game import *\nfrom random import *\n\nset_backdrop('bg.jpg')\ncover = create_sprite('cover.png')\na = create_sprite('cat_0.png', 'cat_1.png')\nb = create_sprite('dog_0.png', 'dog_1.png')\nc = create_sprite('sheep_0.png', 'sheep_1.png')\nd = create_sprite('pig_0.png', 'pig_1.png')\nnote = create_sprite('note.png')\nrules = create_sprite('rules.png')\na.y -= 250\nb.x += 250\nc.y += 250\nd.x -= 250\nnote.move_to(195, 110)\nnote.scale = 0.7\ncover.hidden = True\n\nnotes = [1, 2, 3, 4]\nclock = 0\ncount = 0\nstatus = 'auto'\n\ndef loop():\n global clock, count, status\n \n draw_text(len(notes), 80, 80, 'black', 50)\n \n clock += 1\n if clock % 60 == 0 and status != 'play':\n if notes[count] == 1: play_a()\n if notes[count] == 2: play_b()\n if notes[count] == 3: play_c()\n if notes[count] == 4: play_d()\n count += 1\n if count == len(notes):\n if status == 'auto':\n status = 'play'\n count = 0\n else:\n notes.clear()\n next_level()\n\ndef animation():\n if a.scale \u003c 1: a.scale += 0.1\n if b.scale \u003c 1: b.scale += 0.1\n if c.scale \u003c 1: c.scale += 0.1\n if d.scale \u003c 1: d.scale += 0.1\n if note.scale \u003c 0.7: note.scale += 0.1\n \ndef gamestart():\n rules.hidden = True\n\ndef play_a():\n create_sound('cat.wav')\n a.scale = 0.7\n\ndef play_b():\n create_sound('dog.wav')\n b.scale = 0.7\n\ndef play_c():\n create_sound('sheep.wav')\n c.scale = 0.7\n\ndef play_d():\n create_sound('cat.wav')\n d.scale = 0.7\n \ndef click_a():\n global count\n if notes[count] == 1:\n play_a()\n count += 1\n if count == len(notes): next_level()\n else:\n gameover()\n\ndef click_b():\n global count\n if notes[count] == 2:\n play_b()\n count += 1\n if count == len(notes): next_level()\n else:\n gameover()\n\ndef click_c():\n global count\n if notes[count] == 3:\n play_c()\n count += 1\n if count == len(notes): next_level()\n else:\n gameover()\n\ndef click_d():\n global count\n if notes[count] == 4:\n play_d()\n count += 1\n if count == len(notes): next_level()\n else:\n gameover()\n\ndef next_level():\n global count, status\n notes.append(randint(1, 4))\n status = 'auto'\n count = 0\n note.scale = 0.5\n\ndef gameover():\n create_sprite('result.jpg')\n for i in range(len(notes)):\n n = create_sprite('note.png')\n n.scale = 0.8\n n.x = 170 + (i % 12) * 80\n n.y = 210 + (i // 12) * 200\n stop()\n\na.on('click', click_a)\nb.on('click', click_b)\nc.on('click', click_c)\nd.on('click', click_d)\nrules.on('click', gamestart)\nforever(loop)\nforever(animation)\n","created_at":"2024-06-04T12:46:03.652+08:00","updated_at":"2024-07-18T16:52:42.193+08:00","name":"音樂記憶","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/765530/8cf50f2993c94bbd9bca7212d968c636.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":48,"hashid":"zpesz92wn","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17089194,"file_name":"cat.mp3","project_id":765530,"asset_id":743391,"created_at":"2024-06-04T14:15:34.684+08:00","updated_at":"2024-06-04T14:15:34.684+08:00"},{"id":17089179,"file_name":"duck_1.png","project_id":765530,"asset_id":746580,"created_at":"2024-06-04T12:47:36.248+08:00","updated_at":"2024-06-04T12:47:36.248+08:00"},{"id":17089180,"file_name":"horse_0.png","project_id":765530,"asset_id":746581,"created_at":"2024-06-04T12:47:36.250+08:00","updated_at":"2024-06-04T12:47:36.250+08:00"},{"id":17089171,"file_name":"cat_1.png","project_id":765530,"asset_id":746572,"created_at":"2024-06-04T12:47:34.806+08:00","updated_at":"2024-06-04T12:47:34.806+08:00"},{"id":17089172,"file_name":"chicken_0.png","project_id":765530,"asset_id":746573,"created_at":"2024-06-04T12:47:34.809+08:00","updated_at":"2024-06-04T12:47:34.809+08:00"},{"id":17089181,"file_name":"horse_1.png","project_id":765530,"asset_id":746582,"created_at":"2024-06-04T12:47:36.505+08:00","updated_at":"2024-06-04T12:47:36.505+08:00"},{"id":17089183,"file_name":"pig_0.png","project_id":765530,"asset_id":746584,"created_at":"2024-06-04T12:47:36.844+08:00","updated_at":"2024-06-04T12:47:36.844+08:00"},{"id":17089184,"file_name":"pig_1.png","project_id":765530,"asset_id":746585,"created_at":"2024-06-04T12:47:36.845+08:00","updated_at":"2024-06-04T12:47:36.845+08:00"},{"id":17089177,"file_name":"dog_1.png","project_id":765530,"asset_id":746578,"created_at":"2024-06-04T12:47:35.894+08:00","updated_at":"2024-06-04T12:47:35.894+08:00"},{"id":17089178,"file_name":"duck_0.png","project_id":765530,"asset_id":746579,"created_at":"2024-06-04T12:47:35.896+08:00","updated_at":"2024-06-04T12:47:35.896+08:00"},{"id":17089186,"file_name":"rules.png","project_id":765530,"asset_id":746587,"created_at":"2024-06-04T12:47:37.235+08:00","updated_at":"2024-06-04T12:47:37.235+08:00"},{"id":17089187,"file_name":"sheep_0.png","project_id":765530,"asset_id":746588,"created_at":"2024-06-04T12:47:37.538+08:00","updated_at":"2024-06-04T12:47:37.538+08:00"},{"id":17089188,"file_name":"sheep_1.png","project_id":765530,"asset_id":746589,"created_at":"2024-06-04T12:47:37.540+08:00","updated_at":"2024-06-04T12:47:37.540+08:00"},{"id":17089175,"file_name":"cow_1.png","project_id":765530,"asset_id":746576,"created_at":"2024-06-04T12:47:35.544+08:00","updated_at":"2024-06-04T12:47:35.544+08:00"},{"id":17089176,"file_name":"dog_0.png","project_id":765530,"asset_id":746577,"created_at":"2024-06-04T12:47:35.547+08:00","updated_at":"2024-06-04T12:47:35.547+08:00"},{"id":17089169,"file_name":"bg.jpg","project_id":765530,"asset_id":746570,"created_at":"2024-06-04T12:47:34.445+08:00","updated_at":"2024-06-04T12:47:34.445+08:00"},{"id":17089170,"file_name":"cat_0.png","project_id":765530,"asset_id":746571,"created_at":"2024-06-04T12:47:34.447+08:00","updated_at":"2024-06-04T12:47:34.447+08:00"},{"id":17089173,"file_name":"chicken_1.png","project_id":765530,"asset_id":746574,"created_at":"2024-06-04T12:47:35.165+08:00","updated_at":"2024-06-04T12:47:35.165+08:00"},{"id":17089174,"file_name":"cow_0.png","project_id":765530,"asset_id":746575,"created_at":"2024-06-04T12:47:35.167+08:00","updated_at":"2024-06-04T12:47:35.167+08:00"},{"id":17090754,"file_name":"result.png","project_id":765530,"asset_id":746638,"created_at":"2024-06-05T10:25:40.175+08:00","updated_at":"2024-06-05T10:25:40.175+08:00"},{"id":17090755,"file_name":"note.png","project_id":765530,"asset_id":746639,"created_at":"2024-06-05T10:25:57.800+08:00","updated_at":"2024-06-05T10:25:57.800+08:00"},{"id":17637278,"file_name":"cover.png","project_id":765530,"asset_id":756501,"created_at":"2024-07-18T15:21:14.009+08:00","updated_at":"2024-07-18T15:21:14.009+08:00"},{"id":17638163,"file_name":"cat.wav","project_id":765530,"asset_id":756796,"created_at":"2024-07-18T16:47:46.789+08:00","updated_at":"2024-07-18T16:47:46.789+08:00"},{"id":17638173,"file_name":"dog.wav","project_id":765530,"asset_id":756796,"created_at":"2024-07-18T16:50:08.771+08:00","updated_at":"2024-07-18T16:50:08.771+08:00"},{"id":17638185,"file_name":"sheep.wav","project_id":765530,"asset_id":756797,"created_at":"2024-07-18T16:52:13.829+08:00","updated_at":"2024-07-18T16:52:13.829+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦