Created
April 20, 2017 16:14
-
-
Save joetechem/54902bf528a6fe7ca746b2ed6cdd1d28 to your computer and use it in GitHub Desktop.
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 sys, pygame | |
pygame.init() | |
size = width, height = 600, 600 | |
speed = [1, 1] | |
red = 130, 202, 154 | |
screen = pygame.display.set_mode(size) | |
# ball = pygame.image.load("pygame_logo.gif") | |
ball = pygame.image.load("TechEmDogKoa1.jpg") | |
ballrect = ball.get_rect() | |
while 1: | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: sys.exit() | |
ballrect = ballrect.move(speed) | |
if ballrect.left < 0 or ballrect.right > width: | |
speed[0] = -speed[0] | |
if ballrect.top < 0 or ballrect.bottom > height: | |
speed[1] = -speed[1] | |
screen.fill(red) | |
screen.blit(ball, ballrect) | |
pygame.display.flip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment