{"id":720746,"student_id":10,"content":"from game import *\nfrom random import *\n\ngrid = [[], [], [], [], []]\n\nactive = [False, False, True, False, False]\nsteps = [0, 0, 0]\ncurrent = 0\npush = 0\n\nplayer = create_sprite('ball.png')\nplayer.x = 300\nplayer.y = 600\nplayer.direction = 120\nplayer.step_forward(100)\nup = False\n\nfor i in range(-3, 8):\n for j in range(8):\n b = create_sprite('ball.png')\n b.x = 300\n b.y = 600\n b.direction = 300\n b.step_forward(j * 100)\n b.direction = 60\n b.step_forward(i * 100)\n if i \u003e= 0 and i \u003c= 4: grid[i].append(b)\n if j == 0 and i \u003e= 0 and i \u003c= 4:\n def click(line=i):\n global current, steps, up\n if steps[2] \u003e 0: return\n up = line \u003e current\n steps = [100, abs(line - current) * 100, 100]\n current = line\n b.on('click', click)\n\ndef loop():\n global push\n for i in range(5):\n if active[i]:\n for j in grid[i]:\n j.direction = 120\n j.step_forward(0.2)\n \n if i != current and random() \u003c 0.001:\n active[i] = True\n \n if steps[0] \u003e 0:\n player.direction = 120\n player.step_forward(2)\n steps[0] -= 2\n elif steps[1] \u003e 0:\n player.direction = 60\n player.step_forward(2 if up else -2)\n steps[1] -= 2\n elif steps[2] \u003e 0:\n player.direction = -60\n player.step_forward(2)\n steps[2] -= 2\n \n dist = player.distance_to(grid[current][0])\n if dist \u003c 100:\n for j in grid[current]:\n j.direction = 120\n j.step_forward(- 100 + dist)\n \n if active[current]:\n active[current] = False\n push += 1\n \n draw_text(push, 0, 0, 'black', 30)\n\nforever(loop)","created_at":"2024-03-25T17:54:02.977+08:00","updated_at":"2024-03-26T10:00:40.535+08:00","name":"演唱會","language":"python","screenshot":{"url":"/uploads/project/screenshot/720746/8a1dcb18d91a8904fde4f7c5ccaf26f3.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":328,"hashid":"9ygs5jmgz","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16119245,"file_name":"ball.png","project_id":720746,"asset_id":730461,"created_at":"2024-03-25T17:54:35.128+08:00","updated_at":"2024-03-25T17:54:35.128+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Screenshot
繁中
简中
English
日本語
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer