MCPcopy Index your code
hub / github.com/geekcomputers/Python / spawn_ball

Function spawn_ball

PONG_GAME.py:24–30  ·  view source on GitHub ↗
(direction)

Source from the content-addressed store, hash-verified

22
23
24def 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
33def reset():

Callers 1

new_gameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected