Ejemplo n.º 1
0
def startWindow( width, height, jg):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption(" Resultados")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False
    



    pantalla.fill((134,230,120))
    
    if jg.player.getHP() == 0:
        soundevents.musicLoad("bgm/death.mp3")
        soundevents.musicPlay(-1)
        mensaje = m.getMessage("resultswindow:death", jg.player.getPuntos())
    else:
        soundevents.musicLoad("bgm/results.mp3")
        soundevents.musicSetVolume(0.5)
        soundevents.musicPlay(-1)
        mensaje = m.getMessage('resultswindow:congratulations', jg.player.getPuntos(), jg.player.getMiss(), jg.calculatePunctuation())

    
    pygame.display.flip()
    m.sayCustomMessage(mensaje,1)



    


    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if  pressKey=='accept':
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                else:
                    m.sayCustomMessage(mensaje)
Ejemplo n.º 2
0
    def __checkStepTime(self):
        """se remueven los steps que hayan estado por más del pressspeed  ticks en el stack"""

        for x in range(0, len(self.__prestep)):
            if self.__ticks - self.__prestep[x][0] >= self.__antisipateTime:
                self.__prestep.pop(x)
                self.player.sumarMiss(1)
                soundevents.musicSetVolume(0.3)
                self.consecutivePoints = 0

                self.checkLife(True)
                self.__checkStepTime()
                return ()
            else:
                if len(self.__stepStack) > 0:
                    step = self.__stepStack[0]
                    if step[1] == self.__prestep[x][1]:
                        self.__stepStack.pop(0)
                        self.__prestep.pop(x)
                        soundevents.musicSetVolume(1)

                        self.player.sumarPuntos(1)
                        self.consecutivePoints += 1
                        self.checkLife()
                        self.__checkStepTime()
                        return ()

                    else:
                        self.__prestep.pop(x)
                        self.__stepStack.pop(0)

                        soundevents.musicSetVolume(0.3)
                        self.consecutivePoints = 0
                        self.checkLife(True)

                        self.__checkStepTime()
                        return ()

        for x in range(0, len(self.__stepStack)):
            #escritor.flog("los valores a comparar son: pressSpeed: " + str(self.__pressSpeed))
            #escritor.flog(" lost ticks: " + str(self.__ticks))
            #escritor.flog(" tick actual:  " + str(self.__stepStack))

            if (self.__ticks - self.__stepStack[x][0]) >= self.__pressSpeed:
                self.__stepStack.pop(x)
                #hitEvent(3)
                self.player.sumarMiss(1)
                self.consecutivePoints = 0

                self.checkLife(True)
                soundevents.musicSetVolume(0.3)
                self.__checkStepTime()

                break
Ejemplo n.º 3
0
def startWindow(width, height, jg):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption(" Resultados")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False

    pantalla.fill((134, 230, 120))

    if jg.player.getHP() == 0:
        soundevents.musicLoad("bgm/death.mp3")
        soundevents.musicPlay(-1)
        mensaje = m.getMessage("resultswindow:death", jg.player.getPuntos())
    else:
        soundevents.musicLoad("bgm/results.mp3")
        soundevents.musicSetVolume(0.5)
        soundevents.musicPlay(-1)
        mensaje = m.getMessage('resultswindow:congratulations',
                               jg.player.getPuntos(), jg.player.getMiss(),
                               jg.calculatePunctuation())

    pygame.display.flip()
    m.sayCustomMessage(mensaje, 1)

    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if pressKey == 'accept':
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end = True
                else:
                    m.sayCustomMessage(mensaje)
Ejemplo n.º 4
0
    def hitStep(self, hit):
        if (self.__playMode == 0):
            self.__song.addStep((self.__ticks, hit))
        elif self.__playMode == 1:

            if len(self.__stepStack) > 0:
                if self.__stepStack[0][1] == hit:
                    self.player.sumarPuntos(1)
                    soundevents.musicSetVolume(1)

                    self.__stepStack.pop(0)
                    self.consecutivePoints += 1
                    self.checkLife()

                else:
                    self.player.sumarMiss(1)
                    self.checkLife(True)
                    self.__stepStack.pop(0)
                    soundevents.musicSetVolume(0.3)

            else:
                self.__prestep.append((self.__ticks, hit))
Ejemplo n.º 5
0
    def __init__(self, cancion, modo, tipo=0, jpugador=jugador.Jugador()):
        object.__init__(self)
        self.__ticks = 0
        global hitEvent
        global nextTickEvent
        global stepEvent
        global deatEvent

        nextTickEvent += self.__nextTick

        self.__song = cancion

        self.player = jpugador
        self.player.resetPoints()

        self.player.setHP(self.__song.getStartHp())
        soundevents.musicSetVolume(1)
        soundevents.musicLoad(self.__song.songpath)
        self.__pressSpeed = self.__song.getPressSpeed()
        #print(" este es el presspeed" + str(self.__pressSpeed))
        soundevents.twoHands = self.__song.getHands()
        self.__antisipateTime = self.__song.getAntisipateTime()

        if (modo == 0):

            self.__playMode = 0
            hitEvent += self.hitStep

        elif modo == 1:
            self.__playMode = 1
            stepEvent += self.hitStep
            self.__stepStack = list()
            self.consecutivePoints = 0

            self.__pointMode = tipo
            self.__prestep = []
Ejemplo n.º 6
0
def startWindow( width, height):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("Iniciado menu principal")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    menuitems=[]
    menuitems.append("menuwindow:option0")
    menuitems.append("menuwindow:option1")
    menuitems.append("menuwindow:option2")
    menuitems.append("menuwindow:option3")
    menuitems.append("menuwindow:optionexit")

    titulo = "menuwindow:title"
    last= titulo
    menuhelp = "menuwindow:help"
    
    pygame.display.flip()
    estitulo =True
    
    soundevents.musicLoad("songs/rtms.ogg")
    soundevents.musicPlay(True)
    soundevents.musicSetVolume(0.3)

    
    option=0
    m.sayMessage(titulo)

    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))

        pygame.display.flip()
        

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if estitulo==True:
                        estitulo=False
                        m.sayMessage(menuhelp)
                        last=menuhelp
                    else:
                        if option==4:
                            pygame.display.quit()
                            soundevents.musicFade(1500)
                            time.sleep(2)
                            

                            return(4)
                        else:
                            pygame.display.quit()
                            end=True
                            soundevents.musicFade(1500)
                            return(option)
                elif pressKey == 'down':
                    if estitulo:
                        continue 

                    soundevents.playMove()
                    option+=1
                    if option>=5:
                        option=0
                    m.sayMessage(menuitems[option])



                elif pressKey == 'up':
                    if estitulo:
                        continue 

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=4
                    m.sayMessage(menuitems[option])

                elif(pressKey=='back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    return(4)

                else:
                    if pressKey!= "stop":
                        m.sayMessage(last)
Ejemplo n.º 7
0
def startWindow(width, height):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("Iniciado menu principal")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134, 230, 120))
    menuitems = []
    menuitems.append("menuwindow:option0")
    menuitems.append("menuwindow:option1")
    menuitems.append("menuwindow:option2")
    menuitems.append("menuwindow:option3")
    menuitems.append("menuwindow:optionexit")

    titulo = "menuwindow:title"
    last = titulo
    menuhelp = "menuwindow:help"

    pygame.display.flip()
    estitulo = True

    soundevents.musicLoad("songs/rtms.ogg")
    soundevents.musicPlay(True)
    soundevents.musicSetVolume(0.3)

    option = 0
    m.sayMessage(titulo)

    while (not end):
        reloj.tick(60)
        pantalla.fill((134, 230, 120))

        pygame.display.flip()

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey == 'accept':

                    soundevents.playAccept()
                    if estitulo == True:
                        estitulo = False
                        m.sayMessage(menuhelp)
                        last = menuhelp
                    else:
                        if option == 4:
                            pygame.display.quit()
                            soundevents.musicFade(1500)
                            time.sleep(2)

                            return (4)
                        else:
                            pygame.display.quit()
                            end = True
                            soundevents.musicFade(1500)
                            return (option)
                elif pressKey == 'down':
                    if estitulo:
                        continue

                    soundevents.playMove()
                    option += 1
                    if option >= 5:
                        option = 0
                    m.sayMessage(menuitems[option])

                elif pressKey == 'up':
                    if estitulo:
                        continue

                    soundevents.playMove()
                    option -= 1
                    if option < 0:
                        option = 4
                    m.sayMessage(menuitems[option])

                elif (pressKey == 'back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end = True
                    return (4)

                else:
                    if pressKey != "stop":
                        m.sayMessage(last)
Ejemplo n.º 8
0
def _confirmNewDif(song):
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    menuitems.append(m.getMessage('test'))
    menuitems.append(m.getMessage('cancel'))
    menuitems.append(m.getMessage('confirm'))
    pygame.display.flip()
    
    option=0
    mens=m.getMessage('recordmenu:confirmhelp', len(song.getAllSteps()))
    m.sayCustomMessage(mens,1)
    repeat = mensage

    
    soundevents.musicLoad("bgm/results.mp3")
    soundevents.musicPlay(-1)
    soundevents.musicSetVolume(0.2)
    m.sayCustomMessage(menuitems[option],0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if option==0:
                        song.restartSong()
                        playWindow.startWindow(res[0],res[1],song,1)
                        _confirmNewDif(song)
                        end=True
                        break

                    elif option==1:
                        end=True
                        song.resetSteplist()
                        startWindow(res[0],res[1])
                        break
                    else:
                        end=True
                        song.saveSteplist()
                        escritor.saveSong(song)
                        startWindow(res[0],res[1])
                        break





                    
                    break
                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if option>=len(menuitems):
                        option=0
                    m.sayCustomMessage(menuitems[option],1)


                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=len(menuitems)-1
                    m.sayCustomMessage(menuitems[option],1)


                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(res[0],res[1])

                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
Ejemplo n.º 9
0
def _configureNewDif(song):
    
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=_buildConfigureDifMenu(song)
    
    pygame.display.flip()
    
    option=0
    m.sayCustomMessage(mensage2,1)
    repeat = mensage2

    m.sayCustomMessage(menuitems[option],0)
    esconfirm=False
    mensage3 = m.getMessage('recordmenu:help3',  pygame.key.name(keyManager.getConfiguredKey("l1")), pygame.key.name(keyManager.getConfiguredKey("l2")), pygame.key.name(keyManager.getConfiguredKey("l3")), pygame.key.name(keyManager.getConfiguredKey("l4")), pygame.key.name(keyManager.getConfiguredKey("r1")), pygame.key.name(keyManager.getConfiguredKey("r2")), pygame.key.name(keyManager.getConfiguredKey("r3")), pygame.key.name(keyManager.getConfiguredKey("r4")))

    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    if option==len(menuitems)-1 or esconfirm==True:
                        soundevents.playAccept()
                        if esconfirm==False:
                            esconfirm=True
                            m.sayCustomMessage(mensage3,1)
                            repeat=mensage3
                        else:
                            end=True
                            soundevents.playGoSound()
                            soundevents.musicSetVolume(1)
                            soundevents.musicFade(1500)
                            time.sleep(1)
                            song.resetSteps()
                            j=recordWindow.startWindow(res[0],res[1],song)
                            if j is not None:
                                _confirmNewDif(j)
                            else:
                                startWindow(res[0],res[1])

                            break

                    else:
                        soundevents.playChange()
                        if option==0:
                            m.sayMessage('recordmenu:setdifname')
                            t= textInput.start()
                            if t is not None:
                                song.setSteplistname(t)
                        elif option ==1:
                            h=song.getHands()
                            if h==1:
                                song.setHands(2)
                            else:
                                song.setHands(1)
                        elif option==2:
                            m.sayMessage('recordmenu:setdifhp')
                            t= textInput.start(True)
                            if t is not None:
                                song.setStartHp(int(t))
                        elif option ==3:
                            m.sayMessage('recordmenu:setdifrestorehp')
                            t=textInput.start(True)
                            if t is not None:
                                song.setRestoreHp(int(t))
                        elif option ==4:
                            m.sayMessage('recordmenu:setdifpressspeed')
                            t=textInput.start(True)
                            if t is not None:
                                song.setPressSpeed(int(t))
                        elif option ==5:
                            m.sayMessage('recordmenu:setdifantisipationtime')
                            t=textInput.start(True)
                            if t is not None:
                                song.setAntisipateTime(int(t))

                        menuitems=_buildConfigureDifMenu(song)

                    
                    
                elif pressKey == 'down':
                    
                    
                    if esconfirm==False:

                        soundevents.playMove()
                        option+=1
                        if option>=len(menuitems):
                            option=0
                        m.sayCustomMessage(menuitems[option],1)
                    else:
                        continue

                elif pressKey == 'up':
                    
                    
                    if esconfirm==False:

                        soundevents.playMove()
                        option -= 1 
                        if option<0:
                            option=len(menuitems)-1
                        m.sayCustomMessage(menuitems[option],1)

                    else:
                        continue

                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(res[0],res[1])
                    return()
                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
Ejemplo n.º 10
0
def startWindow( width, height):
    global res
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    songs = escritor.loadAllTotalItems()


    pygame.display.flip()
    

    
    option=0
    m.sayCustomMessage(mensage,1)
    repeat = mensage

    if len(songs) == 0:
        m.sayMessage("selectwindow:nosongs",1)
        return(None)

    soundevents.musicLoad(songs[option].songpath)
    soundevents.musicPlay(-1)
    m.sayCustomMessage(songs[option].name,0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    

                    _selectDif(songs[option])
                    end=True
                    break
                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if option>=len(songs):
                        option=0
                    soundevents.musicLoad(songs[option].songpath)
                    soundevents.musicPlay(-1)
                    m.sayCustomMessage(songs[option].name,1)


                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=len(songs)-1
                    soundevents.musicLoad(songs[option].songpath)
                    soundevents.musicPlay(-1)
                    m.sayCustomMessage(songs[option].name,1)


                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
Ejemplo n.º 11
0
def _selectDif(song):
    
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    if len(song.getAllStepslist()) == 0:
        _configureNewDif(song)
        return()
    pygame.display.flip()
    option=0
    m.sayCustomMessage(mensaje4,1)
    repeat = mensaje4

    m.sayMessage('recordmenu:existmenuitem0',0)
    esconfirm=False
    selectedDif =0


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if esconfirm==False and option!=0:
                        esconfirm=True
                        m.sayCustomMessage(mensaje5)
                        selectedDif=option-1
                        escritor.flog("la dificultad seleccionada es: "+str(selectedDif))
                        repeat=mensaje5
                        option=0
                        escritor.flog("la dificultad seleccionada es: "+str(selectedDif))
                    elif esconfirm == True:
                        if option==1:
                            song.deleteSteplist(selectedDif)
                            _configureNewDif(song)
                            end=True
                            break
                            

                        else:
                            option=0
                            esconfirm=False
                            m.sayCustomMessage(mensaje4)
                            repeat=mensaje4


                    else:
                        _configureNewDif(song)
                        end=True
                        break


                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if esconfirm:
                        if option>1:
                            option=0
                        if option==0:
                            m.sayMessage('cancel')
                        else:
                            m.sayMessage('confirm')


                    else:
                        if option >len(song.getAllStepslist()):
                            option=0
                        if option==0:
                            song.resetSteplist()
                            m.sayMessage('recordmenu:existmenuitem0')
                        else:
                            song.selectSteplist(option-1)
                            h = song.getHands()
                            if h ==2:
                                m.sayMessage('selectwindow:difdescription2', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())
                            else:
                                m.sayMessage('selectwindow:difdescription', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())






                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1
                    if esconfirm:
                        if option<0:
                            option=1
                        if option==0:
                            m.sayMessage('cancel')
                        else:
                            m.sayMessage('confirm')

                    else:
                        if option < 0:
                            option=len(song.getAllStepslist())
                        if option==0:
                            song.resetSteplist()
                            m.sayMessage('recordmenu:existmenuitem0')
                        else:
                            song.selectSteplist(option-1)
                            h = song.getHands()
                            if h ==2:
                                m.sayMessage('selectwindow:difdescription2', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())
                            else:
                                m.sayMessage('selectwindow:difdescription', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())







                elif(pressKey=='back'):
                    

                    
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(1024,768)
                    end=True
                    break
                    


                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
Ejemplo n.º 12
0
def startWindow( width, height):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    songs = escritor.loadAllSongs()

    mensage = m.getMessage("selectwindow:help")
    mensage2 = m.getMessage("selectwindow:help2")
    mensage3 = m.getMessage("selectwindow:help3", pygame.key.name(keyManager.getConfiguredKey("l1")), pygame.key.name(keyManager.getConfiguredKey("l2")), pygame.key.name(keyManager.getConfiguredKey("l3")), pygame.key.name(keyManager.getConfiguredKey("l4")), pygame.key.name(keyManager.getConfiguredKey("r1")), pygame.key.name(keyManager.getConfiguredKey("r2")), pygame.key.name(keyManager.getConfiguredKey("r3")), pygame.key.name(keyManager.getConfiguredKey("r4")))


    pygame.display.flip()
    estitulo =True
    esayuda=False
    

    
    option=0
    m.sayCustomMessage(mensage,1)
    repeat = mensage
    dificultad = 0 

    if len(songs) == 0:
        m.sayMessage("selectwindow:nosongs",1)
        return(None)

    soundevents.musicLoad(songs[option].songpath)
    soundevents.musicPlay(-1)
    m.sayCustomMessage(songs[option].name,0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if estitulo==True and esayuda== False:
                        estitulo=False
                        m.sayCustomMessage(mensage2,1)
                        repeat=mensage2
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 0, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 0, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                        
                    elif estitulo==False and esayuda == False:
                        esayuda = True
                        m.sayCustomMessage(mensage3,1)
                        repeat = mensage3


                    else:
                        soundevents.playGoSound()
                        pygame.display.quit()
                        end=True
                        soundevents.musicFade(1500)
                        return(songs[option])
                elif pressKey == 'down':
                    if estitulo:
                        

                        soundevents.playMove()
                        option+=1
                        if option>=len(songs):
                            option=0
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay(-1)
                        m.sayCustomMessage(songs[option].name,1)


                    elif estitulo == False and esayuda:
                        continue
                    else:
                        soundevents.playChange()
                        dificultad+=1
                        if dificultad>= len(songs[option].getAllStepslist()):
                            dificultad=0
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                elif pressKey == 'up':
                    if estitulo:
                        

                        soundevents.playMove()
                        option -= 1 
                        if option<0:
                            option=len(songs)-1
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay(-1)
                        m.sayCustomMessage(songs[option].name,1)


                    elif esayuda:
                        continue
                    else:
                        soundevents.playChange()
                        dificultad-=1
                        if dificultad< 0:
                            dificultad=len(songs[option].getAllStepslist())-1
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                        


                elif(pressKey=='back'):
                    if estitulo:

                        pygame.display.quit()
                        escritor.flog("cierre por escape")
                        end=True
                    else:
                        estitulo=True
                        esayuda=False
                        option=0
                        dificultad=0
                        repeat= mensage
                        m.sayCustomMessage(mensage,1)
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay()
                        m.sayCustomMessage(songs[option].name,0)



                else:
                    if pressKey!="stop":
                        m.sayCustomMessage(repeat)