In pygame I need to make a flappy bird clone. I need to make recurring pipes so I want to do this by drawing new ones at the end of the screen every couple of seconds. I know there is a pygame.set_timer function but how do I implement this so that it counts in seconds and draws every couple of seconds
Asked
Active
Viewed 280 times
0
-
Have you tried to implement something already? You are getting downvotes because StackOverflow isn't a place for asking someone to write something for you without seeing your attempt(s). – OneCricketeer Mar 14 '16 at 22:20
-
At first, show your code. At second, you should use - pygame.time.Clock() – Sergius Mar 14 '16 at 22:20
-
Yeah I know that but how do I get it to recognize that something is happening every two seconds – Big Aus Mar 14 '16 at 22:36
-
1I'll sell you a computer with PyGame and a flappy bird clone installed. $15,000 – Goodies Mar 14 '16 at 22:37
-
Use some counter. Imagine, you have fps = 60, so in this game loop your counter must be added up to 60 - it means 1 second passed. That's it! – Sergius Mar 14 '16 at 22:47
1 Answers
-1
If you posted your entire code I might be able to help you. Since you didn't post your code you should try something like this.
import time
while True:
if (bird went past tube):
return True
...create(...)
else:
return False

Till
- 4,183
- 3
- 16
- 18

drewteriyaki
- 320
- 1
- 3
- 12