{"id":805843,"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('duck_0.png', 'duck_1.png')\nrules = create_sprite('rules.png')\nbgm = create_sound('bgm.ogg', True)\n\na.y -= 250\nb.x += 250\nc.y += 250\nd.x -= 250\ncover.hidden = True\n\nclock = 0\ncount = 0\nstatus = 'intro'\nnotes = [1, 1, 2, 2, 3, 3, 4, 4, 1, 2, 3, 4]\n\ndef start_game():\n rules.hidden = True\n\ndef loop():\n global clock, count, status\n \n if not rules.hidden: return\n \n draw_text(len(notes), 80, 80, 'black', 50)\n \n clock += 1\n pace = 30 if status != 'intro' else 15\n if clock \u003e 0 and clock % pace == 0 and status != 'play':\n autoplay()\n \n if count == len(notes):\n count = 0\n clock = -90\n if status == 'auto':\n status = 'play'\n elif status == 'play':\n status = 'auto'\n notes.append(randint(1, 4))\n elif status == 'intro':\n status = 'auto'\n notes.clear()\n notes.append(randint(1, 4))\n \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 cover.hidden = status != 'play'\n \ndef autoplay():\n global count\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\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('duck.mp3')\n d.scale = 0.7\n\ndef click_a():\n global count\n if status == 'play':\n if notes[count] == 1:\n play_a()\n count += 1\n else:\n stop()\n\ndef click_b():\n global count\n if status == 'play':\n if notes[count] == 2:\n play_b()\n count += 1\n else:\n stop()\n\ndef click_c():\n global count\n if status == 'play':\n if notes[count] == 3:\n play_c()\n count += 1\n else:\n stop()\n \ndef click_d():\n global count\n if status == 'play':\n if notes[count] == 4:\n play_d()\n count += 1\n else:\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', start_game)\nforever(loop)\n \n","created_at":"2024-07-29T11:11:04.378+08:00","updated_at":"2024-07-29T11:11:20.901+08:00","name":"小小音樂家_完整版 (1)","language":"python","screenshot":{"url":null},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":46,"hashid":"wdksmwv3g","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17836609,"file_name":"cover.png","project_id":805843,"asset_id":760138,"created_at":"2024-07-29T11:11:20.724+08:00","updated_at":"2024-07-29T11:11:20.724+08:00"},{"id":17836610,"file_name":"duck_0.png","project_id":805843,"asset_id":760139,"created_at":"2024-07-29T11:11:20.729+08:00","updated_at":"2024-07-29T11:11:20.729+08:00"},{"id":17836611,"file_name":"bg.jpg","project_id":805843,"asset_id":760140,"created_at":"2024-07-29T11:11:20.734+08:00","updated_at":"2024-07-29T11:11:20.734+08:00"},{"id":17836612,"file_name":"cat_0.png","project_id":805843,"asset_id":760141,"created_at":"2024-07-29T11:11:20.738+08:00","updated_at":"2024-07-29T11:11:20.738+08:00"},{"id":17836613,"file_name":"dog.wav","project_id":805843,"asset_id":760142,"created_at":"2024-07-29T11:11:20.744+08:00","updated_at":"2024-07-29T11:11:20.744+08:00"},{"id":17836614,"file_name":"dog_1.png","project_id":805843,"asset_id":760143,"created_at":"2024-07-29T11:11:20.748+08:00","updated_at":"2024-07-29T11:11:20.748+08:00"},{"id":17836615,"file_name":"cat.wav","project_id":805843,"asset_id":760144,"created_at":"2024-07-29T11:11:20.755+08:00","updated_at":"2024-07-29T11:11:20.755+08:00"},{"id":17836616,"file_name":"pig_0.png","project_id":805843,"asset_id":760145,"created_at":"2024-07-29T11:11:20.759+08:00","updated_at":"2024-07-29T11:11:20.759+08:00"},{"id":17836617,"file_name":"pig_1.png","project_id":805843,"asset_id":760146,"created_at":"2024-07-29T11:11:20.764+08:00","updated_at":"2024-07-29T11:11:20.764+08:00"},{"id":17836618,"file_name":"result.png","project_id":805843,"asset_id":760147,"created_at":"2024-07-29T11:11:20.770+08:00","updated_at":"2024-07-29T11:11:20.770+08:00"},{"id":17836619,"file_name":"rules.png","project_id":805843,"asset_id":760148,"created_at":"2024-07-29T11:11:20.775+08:00","updated_at":"2024-07-29T11:11:20.775+08:00"},{"id":17836620,"file_name":"sheep.wav","project_id":805843,"asset_id":760149,"created_at":"2024-07-29T11:11:20.781+08:00","updated_at":"2024-07-29T11:11:20.781+08:00"},{"id":17836621,"file_name":"cat_1.png","project_id":805843,"asset_id":760150,"created_at":"2024-07-29T11:11:20.785+08:00","updated_at":"2024-07-29T11:11:20.785+08:00"},{"id":17836622,"file_name":"chicken_0.png","project_id":805843,"asset_id":760151,"created_at":"2024-07-29T11:11:20.790+08:00","updated_at":"2024-07-29T11:11:20.790+08:00"},{"id":17836623,"file_name":"duck_1.png","project_id":805843,"asset_id":760152,"created_at":"2024-07-29T11:11:20.795+08:00","updated_at":"2024-07-29T11:11:20.795+08:00"},{"id":17836624,"file_name":"horse_0.png","project_id":805843,"asset_id":760153,"created_at":"2024-07-29T11:11:20.799+08:00","updated_at":"2024-07-29T11:11:20.799+08:00"},{"id":17836625,"file_name":"horse_1.png","project_id":805843,"asset_id":760154,"created_at":"2024-07-29T11:11:20.803+08:00","updated_at":"2024-07-29T11:11:20.803+08:00"},{"id":17836626,"file_name":"note.png","project_id":805843,"asset_id":760155,"created_at":"2024-07-29T11:11:20.808+08:00","updated_at":"2024-07-29T11:11:20.808+08:00"},{"id":17836627,"file_name":"chicken_1.png","project_id":805843,"asset_id":760156,"created_at":"2024-07-29T11:11:20.811+08:00","updated_at":"2024-07-29T11:11:20.811+08:00"},{"id":17836628,"file_name":"cow_0.png","project_id":805843,"asset_id":760157,"created_at":"2024-07-29T11:11:20.859+08:00","updated_at":"2024-07-29T11:11:20.859+08:00"},{"id":17836629,"file_name":"bgm.ogg","project_id":805843,"asset_id":760158,"created_at":"2024-07-29T11:11:20.875+08:00","updated_at":"2024-07-29T11:11:20.875+08:00"},{"id":17836630,"file_name":"cow_1.png","project_id":805843,"asset_id":760159,"created_at":"2024-07-29T11:11:20.880+08:00","updated_at":"2024-07-29T11:11:20.880+08:00"},{"id":17836631,"file_name":"dog_0.png","project_id":805843,"asset_id":760160,"created_at":"2024-07-29T11:11:20.885+08:00","updated_at":"2024-07-29T11:11:20.885+08:00"},{"id":17836632,"file_name":"sheep_0.png","project_id":805843,"asset_id":760161,"created_at":"2024-07-29T11:11:20.890+08:00","updated_at":"2024-07-29T11:11:20.890+08:00"},{"id":17836633,"file_name":"sheep_1.png","project_id":805843,"asset_id":760162,"created_at":"2024-07-29T11:11:20.895+08:00","updated_at":"2024-07-29T11:11:20.895+08:00"},{"id":17836634,"file_name":"duck.mp3","project_id":805843,"asset_id":760163,"created_at":"2024-07-29T11:11:20.900+08:00","updated_at":"2024-07-29T11:11:20.900+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦