I'm trying to get a punch Animation working for my character. But when I run the game I press the key to punch and when it finishes the animation the game gets an error
\Desktop\python projects\Ultamate Brawl\Ultamite BRAWL.py", line 41, in redrawGameWindow win.blit(PunchR[punchcount//2], (xcor, ycor)) IndexError: list index out of range [Finished in 6.4s]
an I looked at my code and it looks fine
def redrawGameWindow():
global punchcount
global walkcount
win.blit(bg, (-70,0))
if walkcount + 1 >= 27:
walkcount = 0
if punch == True:
if punchcount > 49:
punchcount = 1
win.blit(PunchR[punchcount//2], (xcor, ycor))
punchcount += 1
elif isjump:
win.blit(superjump, (xcor,ycor))
elif left:
if walkcount > 49:
walkcount = 1
win.blit(walkLeft[walkcount//4], (xcor, ycor))
walkcount += 1
elif right:
win.blit(walkRight[walkcount//4], (xcor,ycor))
walkcount += 1
else:
win.blit(char, (xcor,ycor))
pygame.display.update()