This repository has been archived on 2026-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
RussianRoulette/__main__.py

73 lines
1.7 KiB
Python

import pygame
from random import randint
def fire():#LETS GO GAMBLING
if randint(1,6) == 6:
PlaySound(GunShot)
#remember to add shock
else:
PlaySound(GunBlank)
screenw = 1280
screenh = 1080
yOffset = 0
pygame.init()
gun = pygame.image.load_animation("gun.webp")
print(gun[0])
#Sounds for the gun :3
PlaySound = pygame.mixer.Sound.play
GunBlank = pygame.mixer.Sound("sfx/gun-blank.mp3")
GunShot = pygame.mixer.Sound("sfx/gun-shot.mp3")
GunSpin = pygame.mixer.Sound("sfx/gun-spin.mp3")
screen = pygame.display.set_mode((screenw,screenh))
MainSurface = pygame.Surface((screenw,screenh-yOffset))
clock = pygame.time.Clock()
running = True #you better start running...
startSpin = False
spinning = False
spinInc = 0
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
PlaySound(GunBlank)
elif event.key == pygame.K_2:
PlaySound(GunShot)
elif event.key == pygame.K_3:
PlaySound(GunSpin)
elif event.key == pygame.K_SPACE:
startSpin = True
PlaySound(GunSpin)
#screen code
screen.fill("black")
pygame.draw.rect(MainSurface, (30,30,30), (0,0,300,100))
screen.blit(MainSurface,(0,yOffset))
#gun code WOO
if startSpin == True or spinning == True:
spinning = True
spinInc += 1
if spinInc == 61:
spinInc = 0
spinning = False
startSpin = False
fire()
screen.blit(gun[spinInc][0],(0,0))
pygame.display.flip()
clock.tick(60)
pygame.quit()