Browse Source

Draw a bucket with text

master
Elis Axelsson 4 years ago
parent
commit
cf86a335f5
  1. 15
      watersteal.py

15
watersteal.py

@ -26,6 +26,18 @@ sky = pygame.Surface((width, height / 4 * 3))
sky.fill((155, 155, 255))
skyrect = pygame.Rect(0, 0, width, (height / 4 * 3))
# Define a bucket.
bucket = pygame.Surface((50, 50), pygame.SRCALPHA)
pygame.draw.polygon(bucket, (204, 204, 204), [
(0, 0), (50, 0), (40, 50), (10, 50)
])
bucketrect = bucket.get_rect()
bucketfont = pygame.font.SysFont(pygame.font.get_default_font(), 20)
buckettext = bucketfont.render("Water", True, (0, 0, 0))
bucket.blit(buckettext, pygame.Rect(8, 10, 30, 30))
while True:
# Handle events
for event in pygame.event.get():
@ -60,5 +72,8 @@ while True:
# Draw ball on buffer
screen.blit(ball, ballrect)
# Draw bucket
screen.blit(bucket, bucketrect)
# Upload buffer to real screen
pygame.display.flip()

Loading…
Cancel
Save