We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load("http://www.pygame.org/docs/tut/intro/ball.gif") 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 = -speed if ballrect.top < 0 or ballrect.bottom > height: speed = -speed screen.fill(black) screen.blit(ball, ballrect) pygame.display.flip()
Add your voice to the tech community where 5M+ people just like you are talking about what matters.