0
while True:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

ball.x += ball_speed_x #This line is unreachable

ball.y += ball_speed_y

It doesn't matter what I type in that line, everything is unreachable. How to fix it?

Mike
  • 14,010
  • 29
  • 101
  • 161
EMM-J
  • 1
  • 3
  • Oh wait i see now that not the whole 'code' is displayed as code. The code is til ball.y += ball_speed_y – EMM-J Oct 30 '20 at 16:30
  • The first few lines are wrapped inside a while-true block, which will repeatedly execute forever. `ball.x += ...` is indeed unreachable, but without knowing your design and intent we can't give an exact answer. I would guess that you would want it to be indented so it's inside the while-true block, based on the info I know. – nanofarad Oct 30 '20 at 16:32
  • hey @nanofarad thx for your answer! I can send you the whole code if you want! – EMM-J Oct 30 '20 at 16:34
  • I currently don't have time to review the whole set of code (just writing up some comments while on a lunch break at work) -- please give my suggestion a try and see if it works, and if not, try to explain further details by [edit]ing your post. – nanofarad Oct 30 '20 at 16:36
  • 2
    i didnt read it good enough. ty for helping you solved my problem! – EMM-J Oct 30 '20 at 16:39

0 Answers0