Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created November 16, 2015 00:19
Show Gist options
  • Save AndyNovo/b31f088a128ed9604578 to your computer and use it in GitHub Desktop.
Save AndyNovo/b31f088a128ed9604578 to your computer and use it in GitHub Desktop.
import pygame
import random
BLACK = (0,0,0)
pygame.init()
WIDTH = 450
HEIGHT = 600
screen = pygame.display.set_mode([WIDTH, HEIGHT])
another_loop = True
clock = pygame.time.Clock()
#Assumes an image names bwclear1.gif is in the current directory
sprite = pygame.image.load("bwclear1.gif") #load an image (blit it onto screen later)
while another_loop:
# --- Basic Event Processing
for event in pygame.event.get():
if event.type == pygame.QUIT:
another_loop = False
# Every loop we will wipe the screen and redraw images
screen.fill(BLACK)
screen.blit(sprite, pygame.mouse.get_pos())
#This sets the frames per second
clock.tick(60)
#This puts the new stuff you've drawn on screen
pygame.display.flip()
#When we've left the while loop exit pygame
pygame.quit()
@AndyNovo
Copy link
Author

bwclear1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment