I am using Python 2.7.6 with pygame and i am still new to programming and pygame.Is there a way i can make it where if i have numbers, it will go to 0 to 1 to 2 to 3 to 4 to 5 instead of just 0 to 5? Like the health system in earthbound, it doesn’t just drop, it ticks down one number at a time. i tried using time.sleep() in a for loop but it just paused my entire game for a second.
for i in range(7): time.sleep(.5) dodged += 1
i tired it without the time.sleep() but it was too fast to even see.
for i in range(7): dodged += 1
Anybody know how to do this?
You should use
for periodic events in your game (in this case the number increasing. Run this code before your event loop:
increase_event = pygame.USEREVENT + 1 pygame.time.set_timer(increase_event, number_change_time_in_milliseconds)
And run this code in your loop:
if event.type == increase_event dodged += 1