i am in the process of creating a simple python program, and i have come across a problem which i can not solve, here is the code
*import pygame from pygame.locals import * from pygame.color import THECOLORS if not pygame.font: print 'Atention, there are no fonts.' if not pygame.mixer: print 'Atention, there is no sound.' pygame.init() blue = (0, 0, 255) red = (255, 0, 0) black = (0, 0, 0) window_width = 1280 window_height = 960 window = pygame.display.set_mode((window_width, window_height)) def circle_func(color, xpos, ypos, ray, movement_x, movment_y): circle = pygame.draw.circle(window, color, (xpos, ypos), ray) return circle circle = circle_func(red, 50, 50, 20, 3, 3) circle2 = circle_func(blue, 100, 100, 10, 3, 3) pygame.display.flip() pygame.key.set_repeat(1000, 100) while True: for event in pygame.event.get(): pass key_pressed = pygame.key.get_pressed() if key_pressed[K_LEFT]: xpos -= movement_x if key_pressed[K_RIGHT]: xpos += movement_x if key_pressed[K_UP]: ypos -= movement_y if key_pressed[K_DOWN]: ypos += movement_y window.fill(black) circle = circle_func(red, 50, 50, 20, 3, 3) circle2 = circle_func(blue, 100, 100, 10, 3, 3) pygame.display.flip()* when you try to move the circles with the left, right, down or up arrow keys it spits out an error saying "xpos is not defined" or "ypos is not defined" depending on if you hit the left/right or up/down keys, please show me what i am doing wrong!
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor