MCPcopy Create free account
hub / github.com/geekcomputers/Python / main

Function main

Flappy Bird - created with tkinter/Flappy Bird.py:58–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56
57
58def main():
59 clock = pygame.time.Clock()
60 bird = Bird()
61 pipes = [Pipe()]
62 score = 0
63
64 running = True
65 while running:
66 for event in pygame.event.get():
67 if event.type == pygame.QUIT:
68 running = False
69 if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
70 bird.flap()
71
72 bird.update()
73 for pipe in pipes:
74 pipe.update()
75 if pipe.x + pipe.image.get_width() < 0:
76 pipes.remove(pipe)
77 pipes.append(Pipe())
78 score += 1
79
80 screen.blit(background_image, (0, 0))
81 bird.draw(screen)
82 for pipe in pipes:
83 pipe.draw(screen)
84
85 pygame.display.update()
86 clock.tick(30)
87
88 pygame.quit()
89
90
91if __name__ == "__main__":

Callers 1

Flappy Bird.pyFile · 0.70

Calls 8

flapMethod · 0.95
updateMethod · 0.95
drawMethod · 0.95
PipeClass · 0.85
BirdClass · 0.70
getMethod · 0.45
removeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected