Browse Source

Score text

master
Elis Axelsson 4 years ago
parent
commit
503ba8afc0
  1. 8
      watersteal.py

8
watersteal.py

@ -40,6 +40,10 @@ playerrect = player.get_rect()
playerrect.bottomleft = (10, (height / 4 * 3))
playerspeed = 0
playerHasBucket = False
playerScore = 0
# Score text
scoreFont = pygame.font.SysFont(pygame.font.get_default_font(), 40)
while True:
# Handle events
@ -85,6 +89,7 @@ while True:
# If player get rekt by the ball, move player back to start position
if playerrect.colliderect(ballrect):
playerScore = 0
playerrect.left = 0
playerHasBucket = False
bucketrect.bottomleft = (width * 0.9, (height / 4 * 3))
@ -113,5 +118,8 @@ while True:
# Draw player
screen.blit(player, playerrect)
scoreText = scoreFont.render("Score: " + str(playerScore), True, (0, 0, 0))
screen.blit(scoreText, pygame.Rect(0, 0, 40, 20))
# Upload buffer to real screen
pygame.display.flip()

Loading…
Cancel
Save