This commit is contained in:
2025-06-13 23:20:32 +01:00
2 changed files with 16 additions and 10 deletions

View File

@ -17,6 +17,8 @@ pygame.init()
gun = pygame.image.load_animation("gun.webp") gun = pygame.image.load_animation("gun.webp")
print(gun[0]) print(gun[0])
GunFlash = pygame.image.load("images/muzzleflash.png")
#Sounds for the gun :3 #Sounds for the gun :3
PlaySound = pygame.mixer.Sound.play PlaySound = pygame.mixer.Sound.play
GunBlank = pygame.mixer.Sound("sfx/gun-blank.mp3") GunBlank = pygame.mixer.Sound("sfx/gun-blank.mp3")
@ -29,6 +31,8 @@ MainSurface = pygame.Surface((screenw,screenh-yOffset))
clock = pygame.time.Clock() clock = pygame.time.Clock()
running = True #you better start running... running = True #you better start running...
#gun variables
startSpin = False startSpin = False
spinning = False spinning = False
spinInc = 0 spinInc = 0
@ -55,16 +59,18 @@ while running:
screen.blit(MainSurface,(0,yOffset)) screen.blit(MainSurface,(0,yOffset))
#gun code WOO #gun code WOO
if startSpin == True or spinning == True: if startSpin == True or spinning == True:#check if space was pressed or if the gun is already spinning
spinning = True spinning = True #keep the gun spinning
spinInc += 1 spinInc += 1 #next gun frame
if spinInc == 61: if spinInc == 61: #if we've reached the end
spinInc = 0 spinInc = 0 #reset frame count
spinning = False spinning = False #stop spinning
startSpin = False startSpin = False #what did i say bitch? stop spinning
fire() fire() #check if the user gets shot
screen.blit(gun[spinInc][0],(0,0))#draw the gun
screen.blit(gun[spinInc][0],(0,0))
pygame.display.flip() pygame.display.flip()

BIN
images/muzzleflash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB