if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: running = False elif event.type == pygame.KEYDOWN and event.key == pygame.K_w: # Toggle wall if wall: space.remove(static_lines1) wall = False else: space.add(static_lines1) wall = True elif event.type == pygame.KEYDOWN and event.key == pygame.K_s: space.gravity = (0.0, -10.0) level.bool_space = True elif event.type == pygame.KEYDOWN and event.key == pygame.K_n: space.gravity = (0.0, -700.0) level.bool_space = False if (pygame.mouse.get_pressed()[0] and x_mouse > 100 and x_mouse < 250 and y_mouse > 370 and y_mouse < 550): mouse_pressed = True if (event.type == pygame.MOUSEBUTTONUP and event.button == 1 and mouse_pressed): # Release new bird mouse_pressed = False if level.number_of_birds > 0: level.number_of_birds -= 1 t1 = time.time()*1000 xo = 154 yo = 156
# Toggle wall if wall: space.remove(static_lines1) wall = False else: space.add(static_lines1) wall = True elif event.type == pygame.KEYDOWN and event.key == pygame.K_e: editor_mode = True space.gravity = 0., 0 elif event.type == pygame.KEYDOWN and event.key == pygame.K_s: if level.bool_space: space.gravity = (0.0, -700.0) else: space.gravity = (0.0, -10.0) level.bool_space = not level.bool_space elif event.type == pygame.KEYDOWN and event.key == pygame.K_r: # Restart in the paused screen restart() level.load_level() game_state = 0 bird_path = [] if (event.type == pygame.MOUSEBUTTONUP and event.button == 1 and mouse_pressed): # Release new bird mouse_pressed = False if level.number_of_birds > 0: level.number_of_birds -= 1 t1 = time.time() * 1000 xo = 154