0

I have a function, and whenever it is called one of the lines has it run sound.play(), which works fine the first time. as soon as i hit the loop the second time, it doesn't do anything. just passes by the sound. but everything else works.


def s_js(): 
    global plane 
    global has_food 
    global has_sound 
    global s_disable 
    global x 
    plane -= 10 
    has_food = False 
    has_sound = False 
    scary.play() 
    while x != 20: 
        chosenimg = pygame.image.load(s.crowjs[x]) 
        newimg = pygame.transform.scale(chosenimg, (1400, 750)) 
        screen.blit(newimg, (0, 0)) 
        pygame.display.flip() 
        time.sleep(.03) 
        x += 1 
        s.loc = 4 
        s_disable = False

D.L
  • 4,339
  • 5
  • 22
  • 45
  • Question needs some code: Please provide enough code so others can better understand or reproduce the problem: https://stackoverflow.com/help/minimal-reproducible-example – D.L Mar 30 '22 at 22:14
  • ```def s_js(): global plane global has_food global has_sound global s_disable global x plane -= 10 has_food = False has_sound = False scary.play() while x != 20: chosenimg = pygame.image.load(s.crowjs[x]) newimg = pygame.transform.scale(chosenimg, (1400, 750)) screen.blit(newimg, (0, 0)) pygame.display.flip() time.sleep(.03) x += 1 s.loc = 4 s_disable = False – tntrobber123 Mar 30 '22 at 22:56
  • please see modified question (with code) and update... – D.L Mar 30 '22 at 23:23

0 Answers0