Whenever I run this code, it stops right before the screen.blit
while still looping, printing the 'debug3'
over and over.
It doesn't even recognize that the screen is not defined, and my intention is for it to run the screen.blit
.
...
playermove = 5
walkL=pygame.image.load("files/sprites/walkL.png")
walkR=pygame.image.load("files/sprites/walkR.png")
currentSprite = walkL
#single sprite size (width, height)
h=128
w=57
numImages = 4
#counter
cImage=0
class Player:
def animation(self):
global cImage,numImages,currentSprite,playerRect,w,h
if (cImage>=numImages-1):
cImage=0
else:
cImage+=1
print('debug3')
screen.blit(currentSprite,playerRect, (cImage*w,0,w,h))
while True:
player.animation()