python - Moving a Sprite Back and Forth in pygame -
i have sprite going on end of screen other, want go , forth forever. ideas?
u = 1 #u x coordinate if u < 430: #480 window siz, want stop @ 430 u += 5 # move 5
should add whole code easier?
you can use delta variable:
delta = 5 u = 1
and have adjusted switch directions:
u += delta if u >= 430: delta = -5 elif u < 50: delta = 5
Comments
Post a Comment