Created
September 28, 2016 07:30
-
-
Save faejr/ec3213db0f47950fa3c99cf431acf345 to your computer and use it in GitHub Desktop.
LightWakeup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame, sys | |
from pygame import * | |
pygame.init() | |
DONE = False | |
#Create a displace surface object | |
screen = pygame.display.set_mode((800, 600), FULLSCREEN) | |
alphaSurface = Surface((800,600)) | |
alphaSurface.fill((212,176,36)) # Dark yellow | |
alphaSurface.set_alpha(255) | |
alph = 255 | |
mainLoop = True | |
while mainLoop: | |
screen.fill((255,255,255)) # Fill the screen with white each update | |
if not DONE: | |
alph -= 0.1 # At each loop we lower the alpha, thus making it lighter | |
alphaSurface.set_alpha(alph) # Set the alpha | |
# Blit it to the screen-surface | |
screen.blit(alphaSurface,(0,0)) | |
if alph <= 100: | |
DONE = True | |
#Enables exit on ESCAPE | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
mainLoop = False | |
elif event.type == KEYDOWN: | |
if event.key == K_ESCAPE: | |
mainLoop = False | |
pygame.display.update() | |
pygame.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment