I am fairly new to PyGame and I am creating a space shooter game. Part of this game are powerups and when a specific powerup is picked up by the player, I want the player not to be able to shoot for 3 seconds. Shooting is done by mouse click.
I can pick up the powerup, I know what powerup the player last picked up, but I am struggling with the event. How I am thinking of implementing is:
- Can't Shoot power up is picked up -> that's done
- Block mouse buttons
- Wait 3 seconds, while the rest of the game is still running
- Unblock mouse buttons.
I am aware that Python functions, such as wait, won't help.
Any ideas/suggestions? Thanks
When you call
clock.tick()
it returns time since the last call. So save that time:dt = clock.tick()
and then use that variable to count down your seconds.Example:
Example 2: