basically, at the moment, in my game the user can shoot as many times as they wish... this defeats the objective of the game (it makes it too easy) as they can just spam bullets. I have a 'Shop' type function which enables the user to purchase upgrades, therefore the spamming defeats the purpose of the shop.
elif event.key == K_SPACE:
newBullet = {'rect': pygame.Rect(bulletX, bulletY, 10, 3), 'surface': bullet}
pistolSound.play()
bullets.append(newBullet)
This is the code, what can I add to it in order prevent the button mashing spam. I'm bad with the pygame time function, but I have a feeling that could be used.
Additionally, i would like to my zombies to spawn consistently instead of at the moment where it is quite random...
timer = clock.tick()
if waveNumber <= 2:
timer += 1
if timer == 2:
newZombie = {'rect':pygame.Rect(zombieX, zombieY, 75, 75), 'surface': zombie}
zombieSound.play()
zombies.append(newZombie)
timer = 0
How would I go about doing this? I think I'm using the time function wrong.
Many thanks, Will.
Limit the number of bullets to some small number: