+ 1
python pygame animation
so about the animation i got all animation images stored in a list and i'm playing it on a loop like state = 0 walk[state] state += 1 if state == 5: state = 0 so, i'm wonder if there's any other way i can use it like when i don't have to use the if statement to make it go back 0
1 Answer
+ 3
state = 0
walk[state]
state = (state + 1) % 5 # or len(lst) instead of 5