Skip to content

Commit

Permalink
improve drawing system
Browse files Browse the repository at this point in the history
  • Loading branch information
bydariogamer committed Jan 6, 2023
1 parent 735d05d commit 518c387
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,11 @@ def draw(self, game):

# draw obstacles
for index in range(len(self.level.obstacles)):
if self.level.obstacles[index].x < config.DISP_WID + 1:
pygame.draw.rect(
game, self.level.colors[index], self.level.obstacles[index]
)
if self.level.obstacles[index].x > config.DISP_WID:
break
pygame.draw.rect(
game, self.level.colors[index], self.level.obstacles[index]
)

# draw character
if not self.life:
Expand Down

0 comments on commit 518c387

Please sign in to comment.