Jul-31-2017, 08:14 PM
I am making a dice game, here is my roll function.
What I want to happen is for the loop to repeat 9 times(or 10 I can't tell) and each time pick a different dice side to blit to mimic rolling the die. Instead, whats happening is it generates a random side on both die like it should and then only blits it the last time.
What I want to happen is for the loop to repeat 9 times(or 10 I can't tell) and each time pick a different dice side to blit to mimic rolling the die. Instead, whats happening is it generates a random side on both die like it should and then only blits it the last time.
def ROLL(): rolltime = 1 #rolltime is a variable that goes up by one each time it loops while True: if rolltime <= 10: DiceRoller1 = random.choice(Dice) #Dice is a list of 6 images, one of each side DiceRoller2 = random.choice(Dice) # in the game there are two dice you roll screen.blit(DiceRoller1,(0,0)) #this and the next line are whats giving me issues screen.blit(DiceRoller2,(75,0)) rolltime += 1 clock.tick(10) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() else: #if rolltime is over ten the loop breaks break