I’m new to pygame, and I’m trying to make a flappy bird clone I’m using pygame.time.Clock at 20 fps, so that the bird moves at a reasonable pace, but the problem is if I spawned in a pipe every tick it would spawn far too many. is there a way to operate on some ticks but not others or have 2 different game clocks?
<code>Clock = pygame.time.Clock()
run = True
While run:
Bird.refresh()
Pipe.move()
Refresh_screen()
For event in pygame.event.get():
If event.type == pygame.QUIT:
run = False
If event.type == pygame.KEYDOWN:
Bird.flap()
Clock(20)
Pygame.QUIT()
</code>
<code>Clock = pygame.time.Clock()
run = True
While run:
Bird.refresh()
Pipe.move()
Refresh_screen()
For event in pygame.event.get():
If event.type == pygame.QUIT:
run = False
If event.type == pygame.KEYDOWN:
Bird.flap()
Clock(20)
Pygame.QUIT()
</code>
Clock = pygame.time.Clock()
run = True
While run:
Bird.refresh()
Pipe.move()
Refresh_screen()
For event in pygame.event.get():
If event.type == pygame.QUIT:
run = False
If event.type == pygame.KEYDOWN:
Bird.flap()
Clock(20)
Pygame.QUIT()
New contributor
user24821756 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.