I'm currently programming a brick-breaker clone using the Pyglet library and I would like to make a timer that counts up to 20 seconds for the game's 'bonuses'(i.e. longer paddle, faster paddle movement, a larger ball). I've been digging the internet as hard as I can but I couldn't find the answer.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Well i don't know your logic of counting bonuses but i think you can acheive 20 seconds timer by creating a thread which will executing after every 20 seconds.
Here i have created function count_bonuses that will contain your game logic and get executed after every 20 seconds.
You can create your own stopflag if you want to stop this thread or create an KeyboardInterrupt to stop the thread with keyboard intruption based on your gamming logic.
Try this.