Nice, the tutorial kind of skips that part doesn't it. However, about one page up from the bottom there's a little bit about restarting the game if the ball goes out of the screen. With this code:
# Check gameover
if (ball_pos.x < 0 or ball_pos.x > screen_size.x):
ball_pos = screen_size*0.5
ball_speed = INITIAL_BALL_SPEED
direction = Vector2(-1, 0)
So you should probably put that stuff (after the if
line) into a restart()
function and call it on ready()
as well.