{"id":783083,"student_id":10,"content":"from game import *\nfrom random import *\n\nbg = create_sprite('bg.png')\nbucket_0 = create_sprite('bucket_0.png')\nbucket_1 = create_sprite('bucket_1.png')\nplayer = create_sprite('p_0.png', 'p_1.png', 'p_2.png')\nrules = create_sprite('rules.png')\nnumbers = ['0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png']\nn1 = game.create_sprite(numbers) #百位數\nn2 = game.create_sprite(numbers) #十位數\nn3 = game.create_sprite(numbers) #個位數\nn1.move_to(200, 70)\nn2.move_to(125, 70)\nn3.move_to(50, 70)\nfruits = []\nscore = 0\nspeed = 1\n\nn1.layer = n2.layer = n3.layer = 10\nrules.layer = 100\nbg.y = 900\nplayer.y = 700\nplayer.y += 900\nbucket_0.move_to(710, 700 + 900)\nbucket_1.move_to(710, 700 + 900)\nbucket_0.layer = 1\nbucket_1.layer = 3\nplayer.layer = 5\nplayer.scale = bucket_0.scale = bucket_1.scale = 1.2\n\nfor i in range(15):\n a = create_sprite('apple.png', 'orange.png', 'mushroom.png')\n a.y = random() * 2000 - 2100\n a.x = random() * 1000 + 100\n a.scale = 1.2\n a.layer = 4\n a.vx = 0\n a.vy = 0\n a.combo = 0\n a.active = False\n fruits.append(a)\n \ndef loop():\n global speed\n if key.space: rules.hidden = True\n if rules.hidden:\n speed += 0.0005\n if bg.y == 0:\n player.y = 700\n update_player()\n update_fruit()\n update_scores()\n else:\n scroll()\n \ndef scroll():\n bg.y -= 3\n player.y -= 3\n bucket_0.y -= 3\n bucket_1.y -= 3\n\ndef update_fruit():\n global score\n for f in fruits:\n if f.active:\n f.y += f.vy\n f.x += f.vx\n f.vy += 1\n f.direction += f.vx\n else:\n f.y += speed * 2\n \n if f.y \u003e= 1000:\n f.y = random() * 2000 - 2000\n f.x = random() * 1000 + 100\n f.costume_id = 0\n if random() \u003c 0.4: f.costume_id = 1\n if random() \u003c 0.2: f.costume_id = 2\n f.direction = random() * 360\n f.combo = 0\n f.vx = 0\n f.vy = 0\n f.hidden = False\n f.layer = 4\n f.active = False\n \n if abs(f.x - (player.x + 30)) \u003c 100 and abs(f.y - player.y + 150) \u003c 50:\n player.y = 710\n f.vx = (f.x - (player.x + 30)) / 20\n f.vy = -15\n f.combo += 1\n f.active = True\n \n \n if abs(f.x - (bucket_0.x + 30)) \u003c 100 and abs(f.y - bucket_0.y + 50) \u003c 30:\n f.layer = 2\n \n if f.layer == 2:\n f.x = bucket_0.x + 30\n if f.costume_id == 2: stop()\n \n if f.layer == 2 and f.y \u003e= 700 and not f.hidden:\n f.hidden = True\n score += f.combo + 1\n \ndef update_player():\n if key.right:\n player.x += 10\n bucket_0.x += 10\n bucket_1.x += 10\n if key.left:\n player.x -= 10\n bucket_0.x -= 10\n bucket_1.x -= 10\n player.costume_id = (player.x // 100) % 2 + 1\n \n# 更新分數\ndef update_scores():\n n1.costume_id = score // 1 % 10 #個位數\n n2.costume_id = score // 10 % 10 #十位數\n n3.costume_id = score // 100 % 10 #百位數\n\nforever(loop)\n\n","created_at":"2024-07-05T11:39:42.810+08:00","updated_at":"2024-07-08T10:39:54.634+08:00","name":"採收蘋果","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/783083/f18ccc5e8a68a332221353d9438ea8fc.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":40,"hashid":"zpes8depp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17426022,"file_name":"apple.png","project_id":783083,"asset_id":752512,"created_at":"2024-07-05T11:39:57.704+08:00","updated_at":"2024-07-05T11:39:57.704+08:00"},{"id":17426023,"file_name":"bg.png","project_id":783083,"asset_id":752513,"created_at":"2024-07-05T11:39:57.706+08:00","updated_at":"2024-07-05T11:39:57.706+08:00"},{"id":17426024,"file_name":"bucket_0.png","project_id":783083,"asset_id":752514,"created_at":"2024-07-05T11:39:58.086+08:00","updated_at":"2024-07-05T11:39:58.086+08:00"},{"id":17426025,"file_name":"bucket_1.png","project_id":783083,"asset_id":752515,"created_at":"2024-07-05T11:39:58.087+08:00","updated_at":"2024-07-05T11:39:58.087+08:00"},{"id":17426026,"file_name":"mushroom.png","project_id":783083,"asset_id":752516,"created_at":"2024-07-05T11:39:58.470+08:00","updated_at":"2024-07-05T11:39:58.470+08:00"},{"id":17426027,"file_name":"orange.png","project_id":783083,"asset_id":752517,"created_at":"2024-07-05T11:39:58.471+08:00","updated_at":"2024-07-05T11:39:58.471+08:00"},{"id":17426979,"file_name":"4.png","project_id":783083,"asset_id":750586,"created_at":"2024-07-05T17:44:53.526+08:00","updated_at":"2024-07-05T17:44:53.526+08:00"},{"id":17426980,"file_name":"5.png","project_id":783083,"asset_id":750587,"created_at":"2024-07-05T17:44:53.528+08:00","updated_at":"2024-07-05T17:44:53.528+08:00"},{"id":17426028,"file_name":"p_0.png","project_id":783083,"asset_id":752518,"created_at":"2024-07-05T11:39:58.944+08:00","updated_at":"2024-07-05T11:39:58.944+08:00"},{"id":17426029,"file_name":"p_1.png","project_id":783083,"asset_id":752519,"created_at":"2024-07-05T11:39:58.946+08:00","updated_at":"2024-07-05T11:39:58.946+08:00"},{"id":17426030,"file_name":"p_2.png","project_id":783083,"asset_id":752520,"created_at":"2024-07-05T11:39:59.590+08:00","updated_at":"2024-07-05T11:39:59.590+08:00"},{"id":17426031,"file_name":"rules.png","project_id":783083,"asset_id":752521,"created_at":"2024-07-05T11:39:59.592+08:00","updated_at":"2024-07-05T11:39:59.592+08:00"},{"id":17426981,"file_name":"6.png","project_id":783083,"asset_id":750588,"created_at":"2024-07-05T17:44:54.413+08:00","updated_at":"2024-07-05T17:44:54.413+08:00"},{"id":17426982,"file_name":"7.png","project_id":783083,"asset_id":750589,"created_at":"2024-07-05T17:44:54.415+08:00","updated_at":"2024-07-05T17:44:54.415+08:00"},{"id":17426983,"file_name":"8.png","project_id":783083,"asset_id":750590,"created_at":"2024-07-05T17:44:55.298+08:00","updated_at":"2024-07-05T17:44:55.298+08:00"},{"id":17426984,"file_name":"9.png","project_id":783083,"asset_id":750591,"created_at":"2024-07-05T17:44:55.300+08:00","updated_at":"2024-07-05T17:44:55.300+08:00"},{"id":17426975,"file_name":"0.png","project_id":783083,"asset_id":750582,"created_at":"2024-07-05T17:44:52.755+08:00","updated_at":"2024-07-05T17:44:52.755+08:00"},{"id":17426976,"file_name":"1.png","project_id":783083,"asset_id":750583,"created_at":"2024-07-05T17:44:52.758+08:00","updated_at":"2024-07-05T17:44:52.758+08:00"},{"id":17426977,"file_name":"2.png","project_id":783083,"asset_id":750584,"created_at":"2024-07-05T17:44:53.131+08:00","updated_at":"2024-07-05T17:44:53.131+08:00"},{"id":17426978,"file_name":"3.png","project_id":783083,"asset_id":750585,"created_at":"2024-07-05T17:44:53.133+08:00","updated_at":"2024-07-05T17:44:53.133+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦