Skip to content

Instantly share code, notes, and snippets.

@GranularBimbo
Last active April 10, 2018 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GranularBimbo/54a603376dc999abee55899fe47a14b9 to your computer and use it in GitHub Desktop.
Save GranularBimbo/54a603376dc999abee55899fe47a14b9 to your computer and use it in GitHub Desktop.
A system I created for animating in python by making python wait a certain amount of seconds by making a variable subtract by 1.
25 = 1 sec
50 = 2 sec
75 = 3 sec
100 = 4 sec
125 = 5 sec
every 25 adds 1 sec
every 50 adds 2 sec
import pygame
pygame.init()
display = pygame.display.set_mode([700,600])
time = 25
running = True
clock = pygame.time.Clock()
FPS = 30
def tick():
global time
if time > 0:
time -= 1
def loop():
global running
global time
global tick
print "odio"
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if time < 1:
print "it worked"
if time > 0:
tick()
print time
pygame.display.update()
clock.tick(FPS)
pygame.quit()
quit()
loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment