Added running total for shock level as more people get shot
This commit is contained in:
30
__main__.py
30
__main__.py
@ -3,13 +3,6 @@ from random import randint
|
||||
|
||||
#Oh god here we go. I'm gonna screw up this entire thing
|
||||
|
||||
def fire():#LETS GO GAMBLING
|
||||
if randint(1,6) == 6:
|
||||
PlaySound(GunShot)
|
||||
#remember to add shock
|
||||
else:
|
||||
PlaySound(GunBlank)
|
||||
|
||||
screenw = 730
|
||||
screenh = 1080
|
||||
yOffset = 0
|
||||
@ -30,12 +23,22 @@ MainSurface = pygame.Surface((screenw,screenh-yOffset))
|
||||
clock = pygame.time.Clock()
|
||||
|
||||
running = True #you better start running...
|
||||
shockScale = 0 #controls shock level sent to PDO (on a scale of 0 to 1)
|
||||
|
||||
#gun variables
|
||||
startSpin = False
|
||||
spinning = False
|
||||
spinInc = 0
|
||||
|
||||
def fire(shockScale):#LETS GO GAMBLING
|
||||
if randint(6,6) == 6:
|
||||
PlaySound(GunShot)
|
||||
return 0.04
|
||||
#remember to add shock
|
||||
else:
|
||||
PlaySound(GunBlank)
|
||||
return 0
|
||||
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
@ -55,12 +58,13 @@ while running:
|
||||
spinning = True #keep the gun spinning
|
||||
if spinInc == 0:
|
||||
PlaySound(GunSpin)
|
||||
spinInc += 1 #next gun frame
|
||||
if spinInc == len(gun): #if we've reached the end
|
||||
spinInc = 0 #reset frame count
|
||||
spinning = False #stop spinning
|
||||
startSpin = False #what did i say bitch? stop spinning
|
||||
fire() #check if the user gets shot
|
||||
spinInc += 1 #next gun frame
|
||||
if spinInc == len(gun): #if we've reached the end
|
||||
spinInc = 0 #reset frame count
|
||||
spinning = False #stop spinning
|
||||
startSpin = False #what did i say bitch? stop spinning
|
||||
shockScale += fire(shockScale) #check if the user gets shot
|
||||
if shockScale > 1: shockScale=1 #keeps shockScale in bounds
|
||||
|
||||
#screen code
|
||||
screen.fill("black")
|
||||
|
||||
Reference in New Issue
Block a user