"jonathan wallis" <mindboggle...@gmail.com> wrote
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
key_pressed = pygame.key.get_pressed()
if key_pressed[K_LEFT]:
xpos -= movement_x
if key_pressed[K_DOWN]:
ypos += movement_y
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"
So where do you think you define xpos and ypos?
You cannot use them until you define them by assigning a value.
xpos -= movement_x
is just shorthand for
xpos = xpos - movement_x
You cannot use xpos on the right before you give it an initial value.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor