Skip to content

Commit 765ceaf

Browse files
Function Missing a letter & Removed Continue
- ball_rect.heigh missing letter t, should be ball_rect.height # continue is removed here to prevent skipping other parts of the loop. In the pygame event loop, using continue immediately after pygame.display.flip() causes the rest of the loop's code to be skipped.
1 parent dc4c3a7 commit 765ceaf

File tree

1 file changed

+1
-2
lines changed
  • projects/build-pong-with-pygame

1 file changed

+1
-2
lines changed

projects/build-pong-with-pygame/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def main():
8787
if event.key == pygame.K_SPACE:
8888
started = True
8989

90-
continue
9190

9291
'''
9392
get the time elapse between now and the last frame
@@ -164,7 +163,7 @@ def main():
164163
# do the same thing with the bottom
165164
if ball_rect.bottom > SCREEN_HEIGHT - ball_rect.height:
166165
ball_accel_y *= -1
167-
ball_rect.top = SCREEN_HEIGHT - ball_rect.heigh
166+
ball_rect.top = SCREEN_HEIGHT - ball_rect.height
168167

169168
# if the ball goes out of bounds, end the game
170169
if ball_rect.left <= 0 or ball_rect.left >= SCREEN_WIDTH:

0 commit comments

Comments
 (0)