I have got a problem in my script. i am trying to make an rpg game(Yeah yeah i just started...). When i run the program and push any of the arrow keys i get an error. Why ?
The errors look like the followings
The syntax error:
The errors look like the followings
Code:
elif event.key == pygame.K_DOWN:
y = y - 20
screen.blit(player[x, y])
Code:
def Walk(self, x, y):
pygame.draw.rect(screen, [0,255,0],[0, 0, 480, 640])
self.image = pygame.image.load(player_images[self.angle])
screen.blit(self.image[x, y])
if self.angle == 0:
y = y - 20
elif self.angle == 1:
x = x + 20
elif self.angle == 2:
y = y + 20
elif self.angle == 3:
x = x - 20
pygame.display.flip()
Code:
screen.blit(self.image[x, y]) TypeError: 'pygame.Surface' object is unsubscriptable Script terminated.
Comment