[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] newbie



Hi guys.

I'm new to python and programming in general so expect noob questions :.)

I've got up to classes & functions & having problems getting round a little input problem.

I've put my keyboard controls in a separate module from the pygames main loop and my 'character' in another module. When I was putting it all in one file, if I held left my 'character' carried on moving left, but now it will only move the specified amount of pixels then stop.



character: main loop: Keyboard controls: def update(self, d, sp): while True: def controls(): if d == 6: D = Keyboard controls output = 0 self.x += sp ball.update(D, 1) for event in pygame.event.get(): elif d == 4: if event.type == QUIT: self.x -= sp pygame.quit() elif d == 8: sys.exit()
           self.y -= sp
elif d == 2: if event.type == KEYDOWN: self.y += sp if event.key == K_RIGHT: output = 6 ............ if event.type == KEYUP: if event.key == K_RIGHT: output = 0 return output

Any sudjestions would be greatly appreciated

os - windows vista
python 3.1

thanks