Browse Source

Add sky and adjust some colors

master
Elis Axelsson 4 years ago
parent
commit
e83d156329
  1. 17
      watersteal.py

17
watersteal.py

@ -9,11 +9,6 @@ size = width, height = 640, 480
speed = [1, 1]
# Define colors
black = 0, 0, 0
white = 255, 255, 255
green = 0, 255, 0
# Set up screen
screen = pygame.display.set_mode(size)
@ -23,9 +18,14 @@ ballrect = ball.get_rect()
# Define ground
ground = pygame.Surface((width, height / 4))
ground.fill(green)
ground.fill((0, 100, 0))
groundrect = pygame.Rect(0, (height / 4 * 3), width, (height / 4))
# Define sky
sky = pygame.Surface((width, height / 4 * 3))
sky.fill((155, 155, 255))
skyrect = pygame.Rect(0, 0, width, (height / 4 * 3))
while True:
# Handle events
for event in pygame.event.get():
@ -49,11 +49,14 @@ while True:
speed[1] = -speed[1]
# Fill screen buffer with black color
screen.fill(black)
screen.fill((0, 0, 0))
# Draw ground on buffer
screen.blit(ground, groundrect)
# Draw sky on buffer
screen.blit(sky, skyrect)
# Draw ball on buffer
screen.blit(ball, ballrect)

Loading…
Cancel
Save