{"id":772229,"student_id":10,"content":"from game import *\nfrom random import *\n\nset_backdrop('bg.png')\nb1 = create_sprite('bucket_1.png')\nb0 = create_sprite('bucket_0.png')\nplayer = create_sprite('player.png')\nb1.move_to(700, 700)\nb0.move_to(700, 700)\nplayer.move_to(600, 700)\n\narr = []\nscore = 0\nspeed = 3\nb1.layer = -2\n\nfor i in range(10):\n s = create_sprite('apple.png', 'mushroom.png')\n s.x = random() * 1000 + 100\n s.y = i * 100\n s.scale = 1.2\n s.combo = 0\n s.vx = 0\n s.vy = 0\n arr.append(s)\n\ndef loop():\n global score, speed\n \n speed += 0.001\n draw_text(score, 10, 10, 'black', 50)\n \n if key.right:\n b0.x += speed * 4\n b1.x += speed * 4\n player.x += speed * 4\n if key.left:\n b0.x -= speed * 4\n b1.x -= speed * 4\n player.x -= speed * 4\n \n for s in arr:\n if s.y \u003e 900:\n s.y -= 1000\n s.x = random() * 1000 + 100\n s.hidden = False\n s.costume_id = 0\n s.layer = 1\n s.combo = 0\n if random() \u003c 0.2: s.costume_id = 1\n \n if s.y \u003c 550 and s.layer != -1 and s.touched(player):\n s.vy = -10\n s.vx = (s.x - player.x) / 10\n s.combo += 1\n \n if abs(s.x - b0.x) \u003c 100 and abs(s.y - b0.y + 140) \u003c 50:\n s.layer = -1\n \n if s.layer == -1: s.x = b0.x\n if s.layer == -1 and s.y \u003e b0.y and not s.hidden:\n s.hidden = True\n if s.costume_id == 0:\n score += 1 + s.combo\n else:\n stop()\n \n if s.combo \u003e 0:\n s.x += s.vx\n s.y += s.vy\n s.vy += 0.5\n elif s.layer == -1:\n s.y += 2\n else:\n s.y += speed\n \nforever(loop)\n\n","created_at":"2024-06-21T10:17:19.540+08:00","updated_at":"2024-07-05T16:51:38.226+08:00","name":"採收蘋果","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/772229/d7f72eb85f77b49e3fb4f79f33aa33bb.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":42,"hashid":"jzms9qwe5","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17216400,"file_name":"mushroom.png","project_id":772229,"asset_id":748989,"created_at":"2024-06-21T10:25:40.804+08:00","updated_at":"2024-06-21T10:25:40.804+08:00"},{"id":17216401,"file_name":"apple.png","project_id":772229,"asset_id":748990,"created_at":"2024-06-21T10:25:40.806+08:00","updated_at":"2024-06-21T10:25:40.806+08:00"},{"id":17216404,"file_name":"player.png","project_id":772229,"asset_id":748993,"created_at":"2024-06-21T10:53:32.865+08:00","updated_at":"2024-06-21T10:53:32.865+08:00"},{"id":17216402,"file_name":"bucket_1.png","project_id":772229,"asset_id":748991,"created_at":"2024-06-21T10:53:32.645+08:00","updated_at":"2024-06-21T10:53:32.645+08:00"},{"id":17216403,"file_name":"bucket_0.png","project_id":772229,"asset_id":748992,"created_at":"2024-06-21T10:53:32.648+08:00","updated_at":"2024-06-21T10:53:32.648+08:00"},{"id":17216397,"file_name":"bg.png","project_id":772229,"asset_id":748986,"created_at":"2024-06-21T10:18:26.360+08:00","updated_at":"2024-06-21T10:18:26.360+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦