View Single Post
Posts: 47 | Thanked: 22 times | Joined on Apr 2010
#9
Originally Posted by El Amir View Post
That's just a false-positive, an error that slipped when I copy-pasted, so that's not the problem I'm afraid



just added that but it doesn't seem to change much.


ANyways, thanks for the input guys!
You have the wrong variable after the second if

It should be "paused = False" but at the moment you have "pause = False"

Code:
#initial conditions
playing = False
paused = True

...

#This is where it doesn't work
def pauseSong(): 
    print "TEST" #This gets printed
    if playing == True:
        pygame.mixer.pause() #This *should* pause the song
        print "paused" # This doesn't get printed :(
        paused = True 
    if playing == False:
        pygame.mixer.unpause()
        pause = False

...
Also, according to this method:
Code:
#Starts the playback of the song
def startSong():
    print "Song Stared"
    playing = True # This changes the initial conditions
    paused = False
    print playing
    song.play()
    time.sleep(.1)
You start playback with "song.play()"
Would it not make more sense for the "pauseSong()" definition to execute "song.pause()" as opposed to "pygame.mixer.pause()"?

I'm not familiar with the mixer class so please correct me

Last edited by Jinux; 2010-04-24 at 23:47.