Created
July 17, 2012 11:59
-
-
Save blambi/3129025 to your computer and use it in GitHub Desktop.
Little game I made to entertain my one year old on a spare laptop
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
#!/usr/bin env python | |
import pygame | |
from random import randint | |
d = pygame.display.set_mode( (800, 600) ) | |
pygame.display.toggle_fullscreen() | |
def rnd_bg(): | |
d.fill(((randint(0, 255), randint(0, 255), randint(0, 255), 255))) | |
pygame.display.flip() | |
while 1: | |
e = pygame.event.wait() | |
if e.type == pygame.KEYDOWN: | |
rnd_bg() | |
elif e.type == pygame.QUIT: | |
break | |
elif e.type == pygame.MOUSEMOTION: | |
c = ((randint(0, 255), randint(0, 255), randint(0, 255), 255)) | |
pygame.draw.circle(d, c, e.pos, abs(e.rel[0])) | |
pygame.display.flip() | |
pygame.time.wait(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment