python pygame animation | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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

28th Aug 2021, 8:02 PM
Tomoe
Tomoe - avatar
1 ответ
+ 3
state = 0 walk[state] state = (state + 1) % 5 # or len(lst) instead of 5
28th Aug 2021, 8:08 PM
ChaoticDawg
ChaoticDawg - avatar