I\'m making a game similar to Space Invaders. Is there a way to check for an event like shooting less frequently? Right now, if you press space bar fast enough the top shot
A few tips: Your first blit is pointless. Since you already start bliting in the while loop.
You could store ship_left and ship_top in a tuple, so there will be less clutter in your code.
Use functions, and give them meaningful names, this way it will be easier for you and others that read your code.
One more thing - your movement function takes in a parameter, but does not do anything with it. It does use an event, so you should pass this instead.
Back to your question. This is how it is normally solved in games like these.
You make a list of missiles. Each KEYDOWN event would create a new missile, and append it to the list. If let's say there are 10 missiles in the list, the missile is not created.
It best to create a separate class Missile. For each object in the list, you should do the following:
This way, there is no need for a timer, and you can limit the shots so that the player does not spam the keyboard. If you really want to limit it based on time, you can use the return value of pygame.Clock.tick() to increment a time_since_last_shot variable. Each keypress would check if the value is big enough, and if so shoot and reset the variable back to 0.