hi guy,when i run my program which contains the following portion of code in the mainloop
i get this error
can anyone help?Thanks in advance
Code:
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)
Code:
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
Comment