(direction)
| 22 | |
| 23 | |
| 24 | def spawn_ball(direction): |
| 25 | global ball_pos, ball_vel # these are vectors stored as lists |
| 26 | ball_pos = [WIDTH / 2, HEIGHT / 2] |
| 27 | if direction == RIGHT: |
| 28 | ball_vel = [random.randrange(120, 240) / 60, random.randrange(60, 180) / 60] |
| 29 | elif direction == LEFT: |
| 30 | ball_vel = [-random.randrange(120, 240) / 60, random.randrange(60, 180) / 60] |
| 31 | |
| 32 | |
| 33 | def reset(): |