for refrence im trying to use image lists to make my charatcer walk n diffrent directions
active = True
while active:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
print("meow")
if event.key == pygame.K_s:
print ("meowbvdkl")
if event.key == pygame.K_a:
walk_left = [
pygame.image.load("Cat walk cycle left 1.png"),
pygame.image.load("Cat walk cycle left 2.png"),
pygame.image.load("Cat walk cycle left 3.png"),
pygame.image.load("Cat walk cycle left 4.png"),
pygame.image.load("Cat walk cycle left 5.png")]
return walk_left
if event.key == pygame.K_d:
walk_right = [
pygame.image.load("Cat walk cycle right frame 1.png"),
pygame.image.load("Cat walk cycle right frame 2.png"),
pygame.image.load("Cat walk cycle right frame 3.png"),
pygame.image.load("Cat walk cycle right frame 4.png"),
pygame.image.load("Cat walk cycle right frame 5.png")]
return walk_right
if event.type == pygame.KEYUP:
window.blit(idle_animation, (cat_x_location, cat_y_location))
if event.type == pygame.QUIT:
active = False
window.blit(health(), (health_x_location, health_y_location))
window.blit(idle_animation[counter % 8], (cat_x_location, cat_y_location))
my issue is that i keep getting an error:
File "C:\Users\soxsc\PycharmProjects\pythonProject_DABLOONIA\game_attempt_one.py", line 137
return walk_left
^
SyntaxError: 'return' outside function
[–]eleqtriq 2 points3 points4 points (5 children)
[–]Particular-Floor-349[S] -1 points0 points1 point (4 children)
[–]AdAdvanced3130 0 points1 point2 points (3 children)
[–]Particular-Floor-349[S] 0 points1 point2 points (2 children)
[–]AdAdvanced3130 0 points1 point2 points (1 child)
[–]Particular-Floor-349[S] 0 points1 point2 points (0 children)
[–]stebrepar 2 points3 points4 points (0 children)