def main(): """ Main game initialization code """ # Set up pygame pygame.init() pygame.mixer.init() game.screen = pygame.display.set_mode(game.window_size, pygame.DOUBLEBUF) keys = set() # Set up game init() # Perform game loop while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.KEYDOWN: keys.add(event.key) if event.type == pygame.KEYUP: keys.discard(event.key) if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: sys.exit() update(keys) # update.py draw() # draw.py # Simply flips the display for drawing pygame.display.update() pygame.display.flip() return
def main(): """ Main game initilization code """ # Set up pygame pygame.init() pygame.mixer.init() game.screen = pygame.display.set_mode(game.window_size, pygame.DOUBLEBUF) keys = set() # Set up game init() # Perform game loop while True: timeDelayed = clock.tick(framerate) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.KEYDOWN: keys.add(event.key) if event.type == pygame.KEYUP: keys.discard(event.key) if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: sys.exit() #print 'velocity: ',game.alvey.velocity #if game.alvey.velocity > 5: # game.alvey.velocity = 5 update(keys) # update.py draw(framerate, timeDelayed) # draw.py # Simply flips the display for drawing pygame.display.update() pygame.display.flip() return
def main(): """ Main game initilization code """ pygame.init() game.screen = pygame.display.set_mode(game.window_size, pygame.DOUBLEBUF) keys = set() # Set up game game.init() # Perform game loop while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.KEYDOWN: keys.add(event.key) if event.type == pygame.KEYUP: keys.discard(event.key) update(keys) draw() return