Last active
April 10, 2018 21:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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