''' by Ching-Shoei Chiang ''' import pygame, sys from pygame.locals import * # (R,G,B) BLACK = (0,0,0) # Three 0 RED = (255,0,0) # Two 0 GREEN = (0,255,0) BLUE = (0,0,255) CYAN = (0,255,255) # One 0 MAGENTA = (255,0,255) YELLOW = (255,255,0) WHITE = (255, 255, 255) # Three 255 pygame.init() screen = pygame.display.set_mode((800, 800)) pygame.display.set_caption("Professor Chiang's Game") dir = 1 y = 200 screen.fill(WHITE) # Setting the main program loop while True: # Main event loop for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() y = y + dir if y > 600 or y < 200: dir = -1 * dir # draw rectangle pygame.draw.circle(screen, CYAN, (600,y),200,0) pygame.display.clear() pygame.display.update()