Fixed Multiple GunSpin sounds playing if the space bar is pressed multiple times

This commit is contained in:
2025-06-14 00:41:52 +01:00
parent aee98bcf40
commit 92a5d7c3ff

View File

@ -49,11 +49,12 @@ while running:
PlaySound(GunSpin)
elif event.key == pygame.K_SPACE:
startSpin = True
PlaySound(GunSpin)
#gun code WOO
if startSpin == True or spinning == True:#check if space was pressed or if the gun is already spinning
spinning = True #keep the gun spinning
if spinInc == 0:
PlaySound(GunSpin)
spinInc += 1 #next gun frame
if spinInc == 61: #if we've reached the end
spinInc = 0 #reset frame count