problem with pygame
Question posted by: dynamo
(Member)
on
July 3rd, 2008 01:17 PM
hi guy,when i run my program which contains the following portion of code in the mainloop
- clock=pygame.time.Clock()
-
while True:
-
sound1.play()
-
clock.tick(60)
-
pKeys = pygame.key.get_pressed()
-
Eves=pygame.event.get()
-
villian.face()
-
villian.hert()
-
if Eves[KEYDOWN] and pKeys[K_UP]:
-
hero.moveup()
-
if Eves[KEYUP] and pKeys[K_UP]:
-
hero.gravity()
-
if Eves[KEYDOWN] and pKeys[K_DOWN]:
-
hero.movedown()
-
if Eves[KEYDOWN] and pKeys[K_RIGHT]:
-
hero.forward()
-
if Eves[KEYDOWN] and pKeys[K_LEFT]:
-
hero.back()
-
if Eves[KEYDOWN] and pKeys[97]:
-
sound.play()
-
hero.reShape()
-
if Eves[KEYUP] and pKeys[97]:
-
hero.Shape()
-
if Eves[KEYDOWN] and pKeys[115]:
-
hero.Kick()
-
if Eves[0]:
-
pygame.quit()
-
raise SystemExit()
-
allsprites.update()
-
screen.blit(background,(0,0))
-
allsprites.draw(screen)
-
pygame.display.flip()
-
time.sleep(1/30)
i get this error
- Traceback (most recent call last):
-
File "C:\Python24\RealSuperDynamo.py", line 145, in ?
-
if Eves[KEYDOWN] and pKeys[K_UP]:
-
IndexError: list index out of range
can anyone help?Thanks in advance
 |
Not the answer you were looking for? Post your question . . .
189,875 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Latest Articles: Read & Comment
Top Python Forum Contributors
|