diff --git a/game.py b/game.py index 2a9f80e..b638371 100644 --- a/game.py +++ b/game.py @@ -26,7 +26,9 @@ class Game(gameUtils.Game): # and should have an animation accompanying it. # see Brosef for the animation. - self.turnHandler = gameUtils.RoundTable(1, self.pm) + # TODO: Add a hook to see if the current player has become inactive. + playerName = random.choice(list(self.pm.keys())) + self.currentlyPlaying = self.pm[playerName] #Sounds for the gun :3 self.playSound = pygame.mixer.Sound.play @@ -78,12 +80,20 @@ class Game(gameUtils.Game): self.playMusic(-1) pygame.mixer.music.set_volume(0.5) + def nextPlayer(self): + playerIndex = list(self.pm.keys()).index(self.currentlyPlaying.name) + playerIndex += 1 + if playerIndex >= len(self.pm): + playerIndex = 0 + playerName = list(self.pm.keys())[playerIndex] + self.currentlyPlaying = self.pm[playerName] + self.popup('Next player', f'Pass shocker to {self.currentlyPlaying.name},\nthen press R-CTRL+ENTER to continue.') def fire(self):#LETS GO GAMBLING if random.randint(1,6) == 6: self.playSound(self.gunShot) - self.turnHandler.playing[0].punish(self.shockScale) - print(f'{self.turnHandler.playing[0].name} is fucking dead.') + self.currentlyPlaying.punish(self.shockScale) + print(f'{self.currentlyPlaying.name} is fucking dead.') return 0.04 #remember to add shock else: @@ -118,8 +128,7 @@ class Game(gameUtils.Game): elif event.type == gameUtils.Timeout and event.timeoutID == 'FireDelay': self.shockScale += self.fire() #check if the user gets shot self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds - self.turnHandler.next() - self.popup('Next player', f'Pass shocker to {self.turnHandler.playing[0].name},\nthen press R-CTRL+ENTER to continue.') + self.nextPlayer() def update(self): """