Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pong.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@

#draws the paddle. Also restricts its movement between the edges
#of the window.
def drawrect(screen,x,y):
if x <= 0:
x = 0
if x >= 699:
x = 699
def drawrect(screen,x,y):
pygame.draw.rect(screen,RED,[x,y,100,20])


Expand Down Expand Up @@ -81,7 +77,11 @@ def drawrect(screen,x,y):
screen.fill(BLACK)
rect_x += rect_change_x
rect_y += rect_change_y

if rect_x <= 0:
rect_x = 0
if rect_x >= 699:
rect_x = 699

ball_x += ball_change_x
ball_y += ball_change_y

Expand Down Expand Up @@ -115,4 +115,4 @@ def drawrect(screen,x,y):
pygame.display.flip()
clock.tick(60)

pygame.quit()
pygame.quit()