Skip to content

Instantly share code, notes, and snippets.

@blambi
Created July 17, 2012 11:59
Show Gist options
  • Save blambi/3129025 to your computer and use it in GitHub Desktop.
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
#!/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