Ejemplo n.º 1
0
 def inisemillas5(self):
 
     secuencia = [1, 2, 3, 4, 5]
     random.shuffle(secuencia)
 
     self.x = 0
     
     self.semilla1.image = self.semilla1.imagenes[secuencia[0]]
     self.semilla1.numero = secuencia[0]
     self.semilla1.rect.x = 0
     self.semilla1.rect.y = Servicios.reajustarCoord(300, self.tablero.alto, 700)
     
     self.semilla2.image = self.semilla2.imagenes[secuencia[1]]
     self.semilla2.numero = secuencia[1]
     self.semilla2.rect.x = 0
     self.semilla2.rect.y = Servicios.reajustarCoord(400, self.tablero.alto, 700)
     
     self.semilla3.image = self.semilla3.imagenes[secuencia[2]]
     self.semilla3.numero = secuencia[2]
     self.semilla3.rect.x = 0
     self.semilla3.rect.y = Servicios.reajustarCoord(340, self.tablero.alto, 700)
     
     self.semilla4.image = self.semilla4.imagenes[secuencia[3]]
     self.semilla4.numero = secuencia[3]
     self.semilla4.rect.x = 0
     self.semilla4.rect.y = Servicios.reajustarCoord(300, self.tablero.alto, 700)
     
     self.semilla5.image = self.semilla5.imagenes[secuencia[4]]
     self.semilla5.numero = secuencia[4]
     self.semilla5.rect.x = 0
     self.semilla5.rect.y = Servicios.reajustarCoord(400, self.tablero.alto, 700)
Ejemplo n.º 2
0
 def semillas7(self):
        
 
     if self.x < Servicios.reajustarCoord(150, self.tablero.alto, 1000):
             self.x += 2
             self.semilla1.rect.move_ip(1, 0)
             self.semilla2.rect.move_ip(4, 0)
             self.semilla3.rect.move_ip(6, 0)
             self.semilla4.rect.move_ip(1, 0)
             self.semilla5.rect.move_ip(4, 0)
             self.semilla6.rect.move_ip(2, 0)
             self.semilla7.rect.move_ip(6, 0)
     else:
         if self.termino2 == 1:
             self.termino = True
             self.termino2 += 1
             
     self.screen.blit(self.planta1.image, self.planta1.rect)
     self.screen.blit(self.planta2.image, self.planta2.rect)   
     self.screen.blit(self.planta3.image, self.planta3.rect) 
     self.screen.blit(self.planta4.image, self.planta4.rect) 
     self.screen.blit(self.planta5.image, self.planta5.rect)
     self.screen.blit(self.planta6.image, self.planta6.rect) 
     
     self.screen.blit(self.semilla1.image, self.semilla1.rect)   
     self.screen.blit(self.semilla2.image, self.semilla2.rect) 
     self.screen.blit(self.semilla3.image, self.semilla3.rect)
     self.screen.blit(self.semilla4.image, self.semilla4.rect) 
     self.screen.blit(self.semilla5.image, self.semilla5.rect)
     self.screen.blit(self.semilla6.image, self.semilla6.rect) 
     self.screen.blit(self.semilla7.image, self.semilla7.rect)
Ejemplo n.º 3
0
    def __init__(self, cursor, screen, clock, padre):
        self.cursor = cursor
        bif = os.path.join("imagenes", "noViolencia", "fondoPuzzle.png")
        self.background = pygame.image.load(bif).convert()
        self.transparente = pygame.image.load(
            os.path.join("imagenes", "transparente.png")).convert_alpha()
        self.screen = screen
        self.clock = clock

        self.tablero = padre

        self.audio = Servicios.cargarSonido("noViolencia.ogg",
                                            os.path.join("audios", "cuentos"))

        self.msjInicio = MensajeEmergente.MensajeInicial(
            40, "CuentoNoViolencia")
        self.msjGanaste = MensajeEmergente.MensajeGanaste(
            28, "JuegoNoViolencia")

        # self.cita = fraseNoViolencia.FraseNoViolencia(self.screen, self.clock, self.cursor, self.tablero)

        self.mouse = Cursor.Mouse()
        self.botonContinuar = Boton.BotonContinuar()
        self.botonTerminar = Boton.BotonTerminar()

        #self.instrucciones = pygame.image.load(os.path.join("imagenes", "inicioNoViolencia.png")).convert_alpha()
        #self.letrero = pygame.image.load(os.path.join("imagenes", "noViolencia", "letreroGanadoPuzzle.png")).convert_alpha()

        self.inicio = True
        self.juego = False
        self.terminar = False
        self.gano = False
        self.unaVez = True

        self.piezas = pygame.sprite.Group()
        self.posiciones = []
        self.loadPiezas()
        self.seleccionada = None
        self.mezclar()

        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png",
                                                "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen(
            "boton_regresar_selec.png", "imagenes")

        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (1200 - 214 - 10), 10)
    def __init__(self):
        # load all our block images
        self.dirImagenes = os.path.join("imagenes", "paz")

        ancho = 50
        imagen = Servicios.cargarImagen("Ico_Semilla.png", self.dirImagenes)
        altoImg = ancho * imagen.get_height() / imagen.get_width()

        self.images = {
            0:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla.png", self.dirImagenes),
                (ancho, altoImg)),
            1:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla1.png", self.dirImagenes),
                (ancho, altoImg)),
            2:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla2.png", self.dirImagenes),
                (ancho, altoImg)),
            3:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla3.png", self.dirImagenes),
                (ancho, altoImg)),
            4:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla4.png", self.dirImagenes),
                (ancho, altoImg)),
            5:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla5.png", self.dirImagenes),
                (ancho, altoImg)),
            6:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla6.png", self.dirImagenes),
                (ancho, altoImg)),
            7:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla7.png", self.dirImagenes),
                (ancho, altoImg)),
            8:
            pygame.transform.smoothscale(
                Servicios.cargarImagen("Ico_Semilla8.png", self.dirImagenes),
                (ancho, altoImg))
        }
    def __init__(self):
        # load all our block images

        self.dirImagenes = os.path.join("imagenes", "paz")
        ancho = 80
        self.image = Servicios.cargarImagen("Ico_Retono.png", self.dirImagenes)
        altoImg = ancho * self.image.get_height() / self.image.get_width()
        self.image = pygame.transform.smoothscale(self.image, (ancho, altoImg))
Ejemplo n.º 6
0
    def __init__(self, cursor, screen, clock, anchoVentana, altoVentana):

        self.ancho = anchoVentana
        self.alto = altoVentana

        resource.set_sounds_path(os.path.join("audios"))
        self.musicaMenu = resource.get_sound("noViolencia_instrum.ogg")
        #self.musicaMenu = Servicios.cargarSonido("noViolencia_instrum.ogg", os.path.join("audios"))
        #self.musicaJuego = Servicios.cargarSonido("musica_juego.ogg", os.path.join("audios"))

        self.dirImagenes = os.path.join("imagenes", "menuPrincipal")

        self.cursor = cursor
        self.screen = screen
        self.clock = clock

        imgBtnJugar = Servicios.cargarImagen("boton_jugar.png",
                                             self.dirImagenes)
        imgBtnJugarSelec = Servicios.cargarImagen("boton_jugar_selec.png",
                                                  self.dirImagenes)

        #imgBtnAprender = Servicios.cargarImagen("boton_aprender.png", self.dirImagenes)
        #imgBtnAprenderSelec = Servicios.cargarImagen("boton_aprender_selec.png", self.dirImagenes)

        imgBtnSalir = Servicios.cargarImagen("boton_salir.png",
                                             self.dirImagenes)
        imgBtnSalirSelec = Servicios.cargarImagen("boton_salir_selec.png",
                                                  self.dirImagenes)

        xBotones = 50
        yInicial = 600
        deltaY = 75

        self.btnJugar = Boton.Boton(imgBtnJugar, imgBtnJugarSelec, xBotones,
                                    yInicial)
        #self.btnAprender = Boton.Boton(imgBtnAprender, imgBtnAprenderSelec, xBotones, yInicial + deltaY)
        self.btnSalir = Boton.Boton(imgBtnSalir, imgBtnSalirSelec, xBotones,
                                    yInicial + deltaY)

        self.mostrarCreditos = True

        self.personaje = None
        self.tablero = None
        self.tutorial = None
        self.ventPersonaje = None
Ejemplo n.º 7
0
 def tex(self):
     x = Servicios.reajustarCoord(100, self.tablero.ancho, 1000)
     self.screen.blit(self.texto1, (x, Servicios.reajustarCoord(300, self.tablero.alto, 700)))
     self.screen.blit(self.texto2, (x, Servicios.reajustarCoord(323, self.tablero.alto, 700)))
     self.screen.blit(self.texto3, (x, Servicios.reajustarCoord(346, self.tablero.alto, 700)))
     self.screen.blit(self.texto4, (x, Servicios.reajustarCoord(369, self.tablero.alto, 700)))
     self.screen.blit(self.texto5, (x, Servicios.reajustarCoord(392, self.tablero.alto, 700)))
     self.screen.blit(self.texto6, (x, Servicios.reajustarCoord(415, self.tablero.alto, 700)))
 def __init__(self, cursor, screen, clock, anchoVentana, altoVentana):
     
     self.ancho = anchoVentana
     self.alto = altoVentana
 
     self.dirImagenes = os.path.join("imagenes", "menuPrincipal")
     
     self.cursor = cursor
     self.screen = screen
     self.clock = clock
     
     
     
     imgBtnJugar = Servicios.cargarImagen("boton_jugar.png", self.dirImagenes)
     imgBtnJugarSelec = Servicios.cargarImagen("boton_jugar_selec.png", self.dirImagenes)
     
     imgBtnAprender = Servicios.cargarImagen("boton_aprender.png", self.dirImagenes)
     imgBtnAprenderSelec = Servicios.cargarImagen("boton_aprender_selec.png", self.dirImagenes)
     
     imgBtnSalir = Servicios.cargarImagen("boton_salir.png", self.dirImagenes)
     imgBtnSalirSelec = Servicios.cargarImagen("boton_salir_selec.png", self.dirImagenes)
     
     xBotones = 50
     yInicial = 580
     deltaY = 75
     
     self.btnJugar = Boton.Boton(imgBtnJugar, imgBtnJugarSelec, xBotones, yInicial)
     self.btnAprender = Boton.Boton(imgBtnAprender, imgBtnAprenderSelec, xBotones, yInicial + deltaY)
     self.btnSalir = Boton.Boton(imgBtnSalir, imgBtnSalirSelec, xBotones, yInicial + deltaY + deltaY)
     
     self.personaje = None
     self.tablero = None
     self.tutorial = None
     self.ventPersonaje = None  
Ejemplo n.º 9
0
 def __init__(self, cursor, screen, clock, padre):
     self.dirImagenes = os.path.join("imagenes", "amor")
     self.cursor = cursor
     self.screen = screen
     self.clock = clock
     self.tablero = padre
     
     self.audio = Servicios.cargarSonido("amor.ogg", os.path.join("audios", "cuentos"))
     
     # self.cita = fraseAmor.FraseAmor(self.screen, self.clock, self.cursor, self.tablero)
     
     # self.botonContinuar = Boton.BotonContinuar()
     # self.botonTerminar = Boton.BotonTerminar()
     
     # self.instrucciones = pygame.image.load(os.path.join("imagenes", "amor", "inicioAmor.png")).convert_alpha()
     # self.letrero = pygame.image.load(os.path.join("imagenes", "amor", "ganaste.png")).convert_alpha()
     # self.letreroReintento = pygame.image.load(os.path.join("imagenes", "amor", "perdiste.png")).convert_alpha()
     # self.transparente = pygame.image.load(os.path.join("imagenes", "verdad", "transparente.png")).convert_alpha()
     
     self.msjInicio = MensajeEmergente.MensajeInicial(40, "CuentoAmor")
     self.msjGanaste = MensajeEmergente.MensajeGanaste(28, "JuegoAmor")
     self.msjPerdiste = MensajeEmergente.MensajePerdiste(28, "JuegoAmor")
     
     #self.mouse = Cursor.Mouse()
     
     self.nivel = 1
     
     self.personaje = self.tablero.personaje
     
     self.fuente1 = pygame.font.Font(None, 24)
     self.texto1 = self.fuente1.render(" Perdiste, intenta de nuevo", 0, (255, 230, 245), (50, 50, 50))
     
     self.fondo = Servicios.cargarImagen("fondo_amor.png", self.dirImagenes)
     self.gano = False
     
     imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png", "imagenes")
     imgBtnRegresarSelec = Servicios.cargarImagen("boton_regresar_selec.png", "imagenes")
     
     self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (1200 - 214 - 10), 10)
Ejemplo n.º 10
0
    def __init__(self, cursor, screen, clock, padre):
        self.dirImagenes = os.path.join("imagenes", "rectitud")
        self.cursor = cursor
        self.screen = screen
        self.clock = clock
        self.audio = Servicios.cargarSonido("rectitud.ogg",
                                            os.path.join("audios", "cuentos"))

        self.tablero = padre
        self.personaje = self.tablero.personaje

        self.botonContinuar = Boton.BotonContinuar()
        self.botonTerminar = Boton.BotonTerminar()

        self.msjInicio = MensajeEmergente.MensajeInicial(40, "CuentoRectitud")
        self.msjGanaste = MensajeEmergente.MensajeGanaste(28, "JuegoRectitud")

        self.transparente = pygame.image.load(
            os.path.join("imagenes", "transparente.png")).convert_alpha()

        self.mouse = Cursor.Mouse()

        self.fondo = Servicios.cargarImagen("fondo_rectitud.png",
                                            self.dirImagenes)

        self.gano = False

        self.objeto = None

        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png",
                                                "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen(
            "boton_regresar_selec.png", "imagenes")

        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (1200 - 214 - 10), 10)
Ejemplo n.º 11
0
 def semillas3(self):
        
 
     if self.x < Servicios.reajustarCoord(150, self.tablero.alto, 1000):
             self.x += 2
             self.semilla1.rect.move_ip(3, 0)
             self.semilla2.rect.move_ip(3, 0)
             self.semilla3.rect.move_ip(4, 0)
     else:
         if self.termino2 == 1:
             self.termino = True
             self.termino2 += 1
         
     self.screen.blit(self.semilla1.image, self.semilla1.rect)   
     self.screen.blit(self.semilla2.image, self.semilla2.rect) 
     self.screen.blit(self.semilla3.image, self.semilla3.rect)
Ejemplo n.º 12
0
    def setTipo(self, tipo):    
        self.tipo = tipo

        
        self.imgColor = Servicios.cargarImagen("Mandala_%s.png" % (self.tipo), self.dirImagenes)
        
        self.imgSinColor = Servicios.cargarImagen("Mandala_%s_ByN.png" % (self.tipo), self.dirImagenes)
        
        self.imgRojoSel = Servicios.cargarImagen("Mandala_%s_Rojo_Seleccionado.png" % (self.tipo), self.dirImagenes)
        
        self.imgAmarilloSel = Servicios.cargarImagen("Mandala_%s_Amarillo_Seleccionado.png" % (self.tipo), self.dirImagenes)
        
        self.imgAzulSel = Servicios.cargarImagen("Mandala_%s_Azul_Seleccionado.png" % (self.tipo), self.dirImagenes)
        
        self.imgMoradoSel = Servicios.cargarImagen("Mandala_%s_Morado_Seleccionado.png" % (self.tipo), self.dirImagenes)
        
        self.imgNaranjaSel = Servicios.cargarImagen("Mandala_%s_Naranja_Seleccionado.png" % (self.tipo), self.dirImagenes)
        
        self.imgVerdeSel = Servicios.cargarImagen("Mandala_%s_Verde_Seleccionado.png" % (self.tipo), self.dirImagenes)
    def __init__(self, ventPadre, cursor, screen, clock, anchoVentana,
                 altoVentana):

        self.dirImagenes = os.path.join("imagenes", "tutorial")

        self.menu = ventPadre

        self.ancho = anchoVentana
        self.alto = altoVentana

        self.cursor = cursor
        self.screen = screen
        self.clock = clock

        #imagen1 = Servicios.cargarImagen(os.path.join("tuto1.png"), self.dirImagenes)
        #imagen2 = Servicios.cargarImagen(os.path.join("tuto2.png"), self.dirImagenes)
        #imagen3 = Servicios.cargarImagen(os.path.join("tuto3.png"), self.dirImagenes)
        #imagen4 = Servicios.cargarImagen(os.path.join("tuto4.png"), self.dirImagenes)
        #imagen5 = Servicios.cargarImagen(os.path.join("tuto5.png"), self.dirImagenes)
        imagen6 = Servicios.cargarImagen(os.path.join("tuto6.png"),
                                         self.dirImagenes)

        self.listaImagenes = [imagen6]

        self.imagenActual = self.listaImagenes[0]

        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png",
                                                "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen(
            "boton_regresar_selec.png", "imagenes")
        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (self.ancho - 214 - 10), 10)

        imgBtnAnterior = Servicios.cargarImagen("boton_anterior.png",
                                                self.dirImagenes)
        imgBtnAnteriorSelec = Servicios.cargarImagen(
            "boton_anterior_selec.png", self.dirImagenes)
        self.btnAnterior = Boton.Boton(imgBtnAnterior, imgBtnAnteriorSelec,
                                       500, 700)

        imgBtnSiguiente = Servicios.cargarImagen("boton_siguiente.png",
                                                 self.dirImagenes)
        imgBtnSiguienteSelec = Servicios.cargarImagen(
            "boton_siguiente_selec.png", self.dirImagenes)
        self.btnSiguiente = Boton.Boton(imgBtnSiguiente, imgBtnSiguienteSelec,
                                        600, 700)
    def run(self):

        fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"),
                                       False)

        contador = 0
        termino = False

        while termino == False:
            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()

                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                    if self.cursor.colliderect(self.btnRegresar.rect):
                        self.menu.run()

                    if self.cursor.colliderect(self.btnAnterior.rect):
                        if contador > 0:
                            contador -= 1

                    if self.cursor.colliderect(self.btnSiguiente.rect):
                        if contador < len(self.listaImagenes) - 1:
                            contador += 1
                        else:
                            termino = True
                            self.menu.ventPersonaje.run()

            self.clock.tick(60)

            self.cursor.update()

            self.screen.blit(fondo, (0, 0))

            self.screen.blit(self.listaImagenes[contador], (0, 0))

            self.btnRegresar.update(self.screen, self.cursor)
            self.btnAnterior.update(self.screen, self.cursor)
            self.btnSiguiente.update(self.screen, self.cursor)

            pygame.display.update()
Ejemplo n.º 15
0
    def run(self):

        fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"),
                                       False)

        fuenteTitulo = pygame.font.SysFont("helvetica", 30, True)
        fuenteTexto = pygame.font.SysFont("helvetica", 20)
        fuenteTextoN = pygame.font.SysFont("helvetica", 20, True)

        if self.personaje.sexo == "M":
            carpetaImg = "nino"
        else:
            carpetaImg = "nina"

        self.personaje.setAncho(self.anchoPersonaje)
        self.personaje.setX(self.origen_x)
        self.personaje.setY(self.origen_y)

        nombreSelec = False
        colegioSelec = False
        edadSelec = False

        faltaInfo = False

        xI = 650
        yI = 100

        yI2 = 300

        yI3 = 500

        self.campoNombre = CampoTexto.CampoTexto(xI - 200, yI3 + 160, 520, 30,
                                                 28)
        self.campoColegio = CampoTexto.CampoTexto(xI - 200, yI3 + 195, 520, 30,
                                                  28)
        self.campoEdad = CampoTexto.CampoTexto(xI - 200, yI3 + 230, 50, 30, 28)

        salir = False

        while salir == False:

            for event in pygame.event.get():

                if event.type == pygame.KEYDOWN:

                    print event.key

                    if edadSelec:

                        longitud = len(self.edad)
                        nuevo = ""
                        cont = 0
                        for t in self.edad:
                            if (cont < longitud - 1):
                                nuevo = nuevo + t
                            cont += 1
                        self.edad = nuevo

                        if longitud <= 2:

                            if event.key == K_1:
                                self.edad = self.edad + "1"
                            if event.key == K_2:
                                self.edad = self.edad + "2"
                            if event.key == K_3:
                                self.edad = self.edad + "3"
                            if event.key == K_4:
                                self.edad = self.edad + "4"
                            if event.key == K_5:
                                self.edad = self.edad + "5"
                            if event.key == K_6:
                                self.edad = self.edad + "6"
                            if event.key == K_7:
                                self.edad = self.edad + "7"
                            if event.key == K_8:
                                self.edad = self.edad + "8"
                            if event.key == K_9:
                                self.edad = self.edad + "9"
                            if event.key == K_0:
                                self.edad = self.edad + "0"

                        if event.key == K_BACKSPACE:
                            longitud = len(self.edad)
                            nuevo = ""
                            cont = 0
                            for t in self.edad:
                                if (cont < longitud - 1):
                                    nuevo = nuevo + t
                                cont += 1
                            self.edad = nuevo

                        self.edad = self.edad + "|"

                    if colegioSelec:

                        longitud = len(self.colegio)
                        nuevo = ""
                        cont = 0
                        for t in self.colegio:
                            if (cont < longitud - 1):
                                nuevo = nuevo + t
                            cont += 1
                        self.colegio = nuevo

                        if longitud <= 33:

                            if event.key == K_a:
                                self.colegio = self.colegio + "A"
                            if event.key == K_b:
                                self.colegio = self.colegio + "B"
                            if event.key == K_c:
                                self.colegio = self.colegio + "C"
                            if event.key == K_d:
                                self.colegio = self.colegio + "D"
                            if event.key == K_e:
                                self.colegio = self.colegio + "E"
                            if event.key == K_f:
                                self.colegio = self.colegio + "F"
                            if event.key == K_g:
                                self.colegio = self.colegio + "G"
                            if event.key == K_h:
                                self.colegio = self.colegio + "H"
                            if event.key == K_i:
                                self.colegio = self.colegio + "I"
                            if event.key == K_j:
                                self.colegio = self.colegio + "J"
                            if event.key == K_k:
                                self.colegio = self.colegio + "K"
                            if event.key == K_l:
                                self.colegio = self.colegio + "L"
                            if event.key == K_m:
                                self.colegio = self.colegio + "M"
                            if event.key == K_n:
                                self.colegio = self.colegio + "N"
                            if event.key == K_o:
                                self.colegio = self.colegio + "O"
                            if event.key == K_p:
                                self.colegio = self.colegio + "P"
                            if event.key == K_q:
                                self.colegio = self.colegio + "Q"
                            if event.key == K_r:
                                self.colegio = self.colegio + "R"
                            if event.key == K_s:
                                self.colegio = self.colegio + "S"
                            if event.key == K_t:
                                self.colegio = self.colegio + "T"
                            if event.key == K_u:
                                self.colegio = self.colegio + "U"
                            if event.key == K_v:
                                self.colegio = self.colegio + "V"
                            if event.key == K_w:
                                self.colegio = self.colegio + "W"
                            if event.key == K_x:
                                self.colegio = self.colegio + "X"
                            if event.key == K_y:
                                self.colegio = self.colegio + "Y"
                            if event.key == K_z:
                                self.colegio = self.colegio + "Z"
                            if event.key == K_SPACE:
                                self.colegio = self.colegio + " "

                        if event.key == K_BACKSPACE:
                            longitud = len(self.colegio)
                            nuevo = ""
                            cont = 0
                            for t in self.colegio:
                                if (cont < longitud - 1):
                                    nuevo = nuevo + t
                                cont += 1
                            self.colegio = nuevo

                        self.colegio = self.colegio + "|"

                    #-----------------------------------------
                    if nombreSelec:

                        longitud = len(self.nombre)
                        nuevo = ""
                        cont = 0
                        for t in self.nombre:
                            if (cont < longitud - 1):
                                nuevo = nuevo + t
                            cont += 1
                        self.nombre = nuevo

                        if longitud <= 33:

                            if event.key == K_a:
                                self.nombre = self.nombre + "A"
                            if event.key == K_b:
                                self.nombre = self.nombre + "B"
                            if event.key == K_c:
                                self.nombre = self.nombre + "C"
                            if event.key == K_d:
                                self.nombre = self.nombre + "D"
                            if event.key == K_e:
                                self.nombre = self.nombre + "E"
                            if event.key == K_f:
                                self.nombre = self.nombre + "F"
                            if event.key == K_g:
                                self.nombre = self.nombre + "G"
                            if event.key == K_h:
                                self.nombre = self.nombre + "H"
                            if event.key == K_i:
                                self.nombre = self.nombre + "I"
                            if event.key == K_j:
                                self.nombre = self.nombre + "J"
                            if event.key == K_k:
                                self.nombre = self.nombre + "K"
                            if event.key == K_l:
                                self.nombre = self.nombre + "L"
                            if event.key == K_m:
                                self.nombre = self.nombre + "M"
                            if event.key == K_n:
                                self.nombre = self.nombre + "N"
                            if event.key == K_o:
                                self.nombre = self.nombre + "O"
                            if event.key == K_p:
                                self.nombre = self.nombre + "P"
                            if event.key == K_q:
                                self.nombre = self.nombre + "Q"
                            if event.key == K_r:
                                self.nombre = self.nombre + "R"
                            if event.key == K_s:
                                self.nombre = self.nombre + "S"
                            if event.key == K_t:
                                self.nombre = self.nombre + "T"
                            if event.key == K_u:
                                self.nombre = self.nombre + "U"
                            if event.key == K_v:
                                self.nombre = self.nombre + "V"
                            if event.key == K_w:
                                self.nombre = self.nombre + "W"
                            if event.key == K_x:
                                self.nombre = self.nombre + "X"
                            if event.key == K_y:
                                self.nombre = self.nombre + "Y"
                            if event.key == K_z:
                                self.nombre = self.nombre + "Z"
                            if event.key == K_SPACE:
                                self.nombre = self.nombre + " "
                        if event.key == K_BACKSPACE:
                            longitud = len(self.nombre)
                            nuevo = ""
                            cont = 0
                            for t in self.nombre:
                                if (cont < longitud - 1):
                                    nuevo = nuevo + t
                                cont += 1
                            self.nombre = nuevo

                        self.nombre = self.nombre + "|"

                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:

                    if self.cursor.colliderect(self.campoNombre.rect2):
                        nombreSelec = True
                        longitud = len(self.nombre)
                        if longitud < 1:
                            self.nombre = self.nombre + "|"
                        else:
                            ultimo = self.nombre[longitud - 1]
                            if ultimo != "|":
                                self.nombre = self.nombre + "|"
                        print "dentro"
                    else:
                        nombreSelec = False
                        print "fuera"
                        longitud = len(self.nombre)
                        if longitud > 0:
                            ultimo = self.nombre[longitud - 1]
                            if ultimo == "|":
                                nuevo = ""
                                cont = 0
                                for t in self.nombre:
                                    if (cont < longitud - 1):
                                        nuevo = nuevo + t
                                    cont += 1
                                self.nombre = nuevo

                    if self.cursor.colliderect(self.campoColegio.rect2):
                        colegioSelec = True
                        longitud = len(self.colegio)
                        if longitud < 1:
                            self.colegio = self.colegio + "|"
                        else:
                            ultimo = self.colegio[longitud - 1]
                            if ultimo != "|":
                                self.colegio = self.colegio + "|"
                        print "dentro"
                    else:
                        colegioSelec = False
                        print "fuera"
                        longitud = len(self.colegio)
                        if longitud > 0:
                            ultimo = self.colegio[longitud - 1]
                            if ultimo == "|":
                                nuevo = ""
                                cont = 0
                                for t in self.colegio:
                                    if (cont < longitud - 1):
                                        nuevo = nuevo + t
                                    cont += 1
                                self.colegio = nuevo

                    if self.cursor.colliderect(self.campoEdad.rect2):
                        edadSelec = True
                        longitud = len(self.edad)
                        if longitud < 1:
                            self.edad = self.edad + "|"
                        else:
                            ultimo = self.edad[longitud - 1]
                            if ultimo != "|":
                                self.edad = self.edad + "|"
                        print "dentro"
                    else:
                        edadSelec = False
                        print "fuera"
                        longitud = len(self.edad)
                        if longitud > 0:
                            ultimo = self.edad[longitud - 1]
                            if ultimo == "|":
                                nuevo = ""
                                cont = 0
                                for t in self.edad:
                                    if (cont < longitud - 1):
                                        nuevo = nuevo + t
                                    cont += 1
                                self.edad = nuevo

                    if self.cursor.colliderect(self.personaje.rect):
                        print "click en personaje"

                    self.mouse.rect.center = pygame.mouse.get_pos()

                    if pygame.sprite.collide_rect(self.botonContinuar,
                                                  self.mouse):
                        faltaInfo = False

                    if self.cursor.colliderect(self.btnGuardar.rect):
                        if self.nombre == "" or self.colegio == "" or self.edad == "":
                            faltaInfo = True
                        else:
                            salir = True
                            self.personaje.setNombre(self.nombre)
                            self.personaje.setColegio(self.colegio)
                            self.personaje.setEdad(self.edad)
                            self.ventanaPadre.setPersonaje(
                                self.personaje, self.personaje.imagen)
                            self.ventanaPadre.tablero.run()

                    if self.cursor.colliderect(self.btnRegresar.rect):
                        salir = True
                        self.ventanaPadre.run()

                    if self.cursor.colliderect(self.btnNina.rect):
                        self.personaje.setSexo("F")

                        imagen = Servicios.cargarImagen(
                            "Nina_Camina-01.png",
                            os.path.join("imagenes", "verdad"))
                        self.personaje.setImagen(imagen)

                    if self.cursor.colliderect(self.btnNino.rect):
                        self.personaje.setSexo("M")

                        imagen = Servicios.cargarImagen(
                            "Frente1.png", os.path.join("imagenes", "verdad"))
                        self.personaje.setImagen(imagen)

                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()

            self.clock.tick(60)

            self.cursor.update()

            self.screen.blit(fondo, (0, 0))

            self.personaje.dibujar(self.screen)

            self.btnNino.update(self.screen, self.cursor)
            self.btnNina.update(self.screen, self.cursor)

            self.btnRegresar.update(self.screen, self.cursor)

            self.btnGuardar.update(self.screen, self.cursor)

            textoCabeza = self.fuenteGrande.render("Elige a tu personaje:", 1,
                                                   (255, 255, 255))

            self.screen.blit(textoCabeza, (10, 10))

            textoNombre = self.fuente.render("Nombre: ", 1, (255, 255, 255))
            self.screen.blit(textoNombre, (xI - 320, yI3 + 150))

            textoColegio = self.fuente.render("Colegio: ", 1, (255, 255, 255))
            self.screen.blit(textoColegio, (xI - 317, yI3 + 185))

            textoEdad = self.fuente.render("Edad: ", 1, (255, 255, 255))
            self.screen.blit(textoEdad, (xI - 290, yI3 + 220))

            self.campoNombre.setText(self.nombre)
            self.campoColegio.setText(self.colegio)
            self.campoEdad.setText(self.edad)

            self.screen.blit(self.campoNombre.image,
                             (self.campoNombre.x, self.campoNombre.y))
            self.screen.blit(self.campoColegio.image,
                             (self.campoColegio.x, self.campoColegio.y))
            self.screen.blit(self.campoEdad.image,
                             (self.campoEdad.x, self.campoEdad.y))

            if faltaInfo:
                self.screen.blit(self.transparente, (0, 0))
                self.screen.blit(self.letreroIncorrecto, (382, 198))
                self.botonContinuar.rect.center = (600, 560)
                self.screen.blit(self.botonContinuar.image,
                                 self.botonContinuar.rect)

            pygame.display.update()
Ejemplo n.º 16
0
    def run(self):
        
        # pygame.mouse.set_visible(True)
        
        inicio = True
        juego = False
        # terminar = False
        gano = False
        # perdio = False
        
        pasoSonidoExito = False
        
        noPaso = True
        
        
        
        self.audio.play()
        
        while noPaso:
            for event in pygame.event.get():
                    if event.type == QUIT:
                            pygame.quit()
                            sys.exit()
                            
                    if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                        
                        if self.cursor.colliderect(self.btnRegresar.rect):
                            self.tablero.sonido2.stop()
                            self.audio.stop()
                            noPaso = False
                            self.tablero.sonido.play(-1)
                            self.tablero.run()
                            
                        if self.cursor.colliderect(self.msjInicio.btn.rect):
                            self.msjInicio.visible = False
                            self.audio.stop()
                            self.tablero.sonido2.play(-1)
                            inicio = False
                            juego = True
                    
                        if self.cursor.colliderect(self.msjGanaste.btn.rect):
                            self.msjGanaste.visible = False
                            gano = False
                            noPaso = False
                            self.tablero.sonido2.stop()
                            self.tablero.pasoCuentoPaz = True
                            self.tablero.compartir.run("Amor","Juego")
                        
                        self.mouse.rect.center = pygame.mouse.get_pos()
                        
                        #=======================================================
                        # if gano and pygame.sprite.collide_rect(self.botonTerminar, self.mouse):
                        #    gano = False
                        #    noPaso = False
                        #    self.tablero.sonido2.stop()
                        #    self.tablero.pasoCuentoPaz = True
                        #    self.tablero.compartir.run("Amor","Juego")
                        #=======================================================
                            #self.tablero.sonido.play(-1)
                            #self.tablero.run() 
                        
                        #=======================================================
                        # if inicio and pygame.sprite.collide_rect(self.botonContinuar, self.mouse):
                        #    inicio = False
                        #    juego = True
                        #=======================================================
                        
                        mousecoords = pygame.mouse.get_pos() 
                        coordinateRect = Rect(mousecoords[0], mousecoords[1], 10, 10)
                        if self.semilla1.rect.colliderect(coordinateRect):
                            if not(self.orden.__contains__(self.semilla1.numero)) and not self.termino:
                                self.orden.append(self.semilla1.numero)
                                self.semilla1.image = self.semilla1.imagenes[8]
                        if self.semilla2.rect.colliderect(coordinateRect):
                            if not(self.orden.__contains__(self.semilla2.numero)) and not self.termino:
                                self.orden.append(self.semilla2.numero)
                                self.semilla2.image = self.semilla2.imagenes[8]
                        if self.semilla3.rect.colliderect(coordinateRect):
                            if not(self.orden.__contains__(self.semilla3.numero)):
                                self.orden.append(self.semilla3.numero)
                                self.semilla3.image = self.semilla3.imagenes[8]
                        if self.vamos5 or self.vamos7:
                            if self.semilla4.rect.colliderect(coordinateRect):
                                if not(self.orden.__contains__(self.semilla4.numero)) and not self.termino:
                                    self.orden.append(self.semilla4.numero) 
                                    self.semilla4.image = self.semilla4.imagenes[8]  
                            if self.semilla5.rect.colliderect(coordinateRect):
                                if not(self.orden.__contains__(self.semilla5.numero)) and not self.termino:
                                    self.orden.append(self.semilla5.numero) 
                                    self.semilla5.image = self.semilla5.imagenes[8]
                        if self.vamos7:
                            if self.semilla6.rect.colliderect(coordinateRect):
                                if not(self.orden.__contains__(self.semilla6.numero)) and not self.termino:
                                    self.orden.append(self.semilla6.numero)
                                    self.semilla6.image = self.semilla6.imagenes[8]
                            if self.semilla7.rect.colliderect(coordinateRect):
                                if not(self.orden.__contains__(self.semilla7.numero)) and not self.termino:
                                    self.orden.append(self.semilla7.numero)
                                    self.semilla7.image = self.semilla7.imagenes[8]  
                                
            self.screen.blit(self.background, (0, 0))
            self.clock.tick(60)
            self.cursor.update()
            
            # otro = ((pygame.time.get_ticks()/1000)<12)
            
            

            
            if inicio:
                self.msjInicio.visible = True
                self.btnRegresar.update(self.screen, self.cursor)
                #===============================================================
                # self.screen.blit(self.transparente, (0, 0))
                # self.btnRegresar.update(self.screen, self.cursor)
                # self.screen.blit(self.instrucciones, (600 - 425, 100))
                # self.botonContinuar.rect.center = (600, 525)
                # self.screen.blit(self.botonContinuar.image, self.botonContinuar.rect)
                #===============================================================
                self.inisemillas3()
                
            elif juego:
                
                self.btnRegresar.update(self.screen, self.cursor)
                    
                if self.vamos3:
                    if not(self.termino):
                        self.semillas3()
                        if len(self.orden) == 3:
                            if self.orden3():
                                self.screen.blit(self.texto8, (Servicios.reajustarCoord(400, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                self.orden = []
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                pygame.display.update()
                                pygame.time.delay(4000)
                                self.vamos3 = False
                                self.termino2 = 1
                                self.inisemillas5()
                                self.vamos5 = True
                            else:
                                self.screen.blit(self.texto7, (Servicios.reajustarCoord(400, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                self.orden = []
                                self.termino2 = 1
                                self.inisemillas3()
                                self.puntaje -= 200
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                pygame.display.update()
                                pygame.time.delay(4000)
                        # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                        # self.screen.blit(texto9, (5, 5))
                        pygame.display.update()
                    else:
                        pygame.time.delay(5000)
                        self.semilla1.image = self.semilla1.imagenes[0]
                        self.semilla2.image = self.semilla2.imagenes[0]
                        self.semilla3.image = self.semilla3.imagenes[0]
                        self.termino = False
                    
                elif self.vamos5:
                    if not(self.termino):
                        self.semillas5()
                        if len(self.orden) == 5:
                            if self.orden5():
                                self.screen.blit(self.texto8, (Servicios.reajustarCoord(400, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                self.orden = []
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                pygame.display.update()
                                pygame.time.delay(4000)
                                self.vamos5 = False
                                self.termino2 = 1
                                self.inisemillas7()
                                self.vamos7 = True
                            else:
                                
                                self.screen.blit(self.texto7, (Servicios.reajustarCoord(400, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                self.orden = []
                                self.termino2 = 1
                                self.inisemillas5()
                                self.puntaje -= 200
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                pygame.display.update()
                                pygame.time.delay(4000)
                        # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                        # self.screen.blit(texto9, (5, 5))
                        pygame.display.update()
                    else:
                        pygame.time.delay(5000)
                        self.semilla1.image = self.semilla1.imagenes[0]
                        self.semilla2.image = self.semilla2.imagenes[0]
                        self.semilla3.image = self.semilla3.imagenes[0]
                        self.semilla4.image = self.semilla4.imagenes[0]
                        self.semilla5.image = self.semilla5.imagenes[0]
                        self.termino = False
                elif self.vamos7:
                    if not(self.termino):
                        self.semillas7()
                        if len(self.orden) == 7:
                            if self.orden7():
                                self.orden = []
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                # if self.puntaje > 2400:
                                # texto10 = self.fuente1.render("Has completado el nivel de paz", 0, (255, 230, 245), (50, 50, 50))
                                # self.screen.blit(texto10, (Servicios.reajustarCoord(380, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                # pygame.display.update()
                                # pygame.time.delay(4000)
                                self.vamos7 = False
                                self.vamos3 = True
                                self.termino2 = 1
                                self.puntaje = 5000
                                
                                
                                # self.texto = True
                # gano
                                juego = False
                                gano = True
                                # noPaso = False
                                # self.tablero.pasoPaz = True
                                # self.cita.run()
                                #===============================================
                                # else:
                                #    texto10 = self.fuente1.render("No obtuviste el puntaje suficiente. Intenta de nuevo", 0, (255, 230, 245), (50, 50, 50))
                                #    self.screen.blit(texto10, (Servicios.reajustarCoord(280, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                #    self.puntaje = 5000
                                #    pygame.display.update()
                                #    pygame.time.delay(4000)
                                #    self.vamos7 = False
                                #    self.vamos3 = True
                                #    self.termino2 = 1
                                #    noPaso = False
                                #    self.texto = True
                                #===============================================
                                    
                                
                
                            else:
                                self.screen.blit(self.texto7, (Servicios.reajustarCoord(400, self.tablero.ancho, 1000), Servicios.reajustarCoord(350, self.tablero.alto, 700)))
                                self.orden = []
                                self.termino2 = 1
                                self.inisemillas7()
                                self.puntaje -= 200
                                # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                                # self.screen.blit(texto9, (5, 5))
                                pygame.display.update()
                                pygame.time.delay(4000)
                        # texto9 = self.fuente1.render("Puntaje " + str(self.puntaje), 0, (50, 50, 50))
                        # self.screen.blit(texto9, (5, 5))
                        pygame.display.update()
                    else:
                        pygame.time.delay(5000)
                        self.semilla1.image = self.semilla1.imagenes[0]
                        self.semilla2.image = self.semilla2.imagenes[0]
                        self.semilla3.image = self.semilla3.imagenes[0]
                        self.semilla4.image = self.semilla4.imagenes[0]
                        self.semilla5.image = self.semilla5.imagenes[0]
                        self.semilla6.image = self.semilla6.imagenes[0]
                        self.semilla7.image = self.semilla7.imagenes[0]
                        self.termino = False
            
            elif gano:
                self.screen.blit(self.planta1.image, self.planta1.rect)
                self.screen.blit(self.planta2.image, self.planta2.rect)   
                self.screen.blit(self.planta3.image, self.planta3.rect) 
                self.screen.blit(self.planta4.image, self.planta4.rect) 
                self.screen.blit(self.planta5.image, self.planta5.rect)
                self.screen.blit(self.planta6.image, self.planta6.rect) 
                
                self.screen.blit(self.semilla1.image, self.semilla1.rect)   
                self.screen.blit(self.semilla2.image, self.semilla2.rect) 
                self.screen.blit(self.semilla3.image, self.semilla3.rect)
                self.screen.blit(self.semilla4.image, self.semilla4.rect) 
                self.screen.blit(self.semilla5.image, self.semilla5.rect)
                self.screen.blit(self.semilla6.image, self.semilla6.rect) 
                self.screen.blit(self.semilla7.image, self.semilla7.rect)
                
                if pasoSonidoExito == False:
                    self.tablero.sonidoExito.play()
                    pasoSonidoExito = True
                
                self.msjGanaste.visible = True
                
                #===============================================================
                # self.screen.blit(self.transparente, (0, 0))
                # self.screen.blit(self.letrero, (380, 100))
                # self.screen.blit(self.botonTerminar.image, self.botonTerminar.rect)
                #===============================================================
                    
            
            self.msjInicio.update(self.screen, self.cursor)
            self.msjGanaste.update(self.screen, self.cursor)       
            pygame.display.update()
Ejemplo n.º 17
0
    def run(self):
        
        inicio = True
        juego = False
        gano = False
        
        pasoSonidoExito = False
        
        fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"), False)
        
        color = None
        
        area = None
        
        imgArea1 = None
        imgArea2 = None
        imgArea3 = None
        imgArea4 = None
        imgArea5 = None
        imgArea6 = None
        
        area1Correcto = False
        area2Correcto = False
        area3Correcto = False
        area4Correcto = False
        area5Correcto = False
        area6Correcto = False
        
        pasoSilencio = False
        
        segundos = 0
        frames = 0
        silencio = True
        
        fuenteTitulo = pygame.font.SysFont("helvetica", 30, True)
        fuenteTexto = pygame.font.SysFont("helvetica", 20)
        fuenteTextoN = pygame.font.SysFont("helvetica", 20, True)
        
        textoColorear = self.fuenteGrande.render("Selecciona primero un area y luego un color para colorear", 1, (255, 255, 255))
        
        salir = False
        
        while salir == False:
            
            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
                
                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                    
                    if self.cursor.colliderect(self.btnRegresar.rect):
                        pygame.mouse.set_visible(True)
                        salir = True
                        self.tablero.sonido.play(-1)
                        self.tablero.run()
                        
                        
                    if self.cursor.colliderect(self.btnAyuda.rect):
                        self.screen.blit(self.imgColor, (self.x, self.y))
                        pygame.display.update()
                        pygame.time.delay(2000)
                        
                    if self.cursor.colliderect(self.msjInicio.btn.rect):
                        self.msjInicio.visible = False
                        inicio = False
                        juego = True
                        
                    if self.cursor.colliderect(self.msjGanaste.btn.rect):
                        if self.tipo == "Flor":
                            self.tablero.pasoSilencioAmor = True
                        if self.tipo == "Sol":
                            self.tablero.pasoSilencioRectitud = True
                        if self.tipo == "Hojas":
                            self.tablero.pasoSilencioPaz = True
                        if self.tipo == "Nino":
                            self.tablero.pasoSilencioVerdad = True
                        if self.tipo == "Flor2":
                            self.tablero.pasoSilencioNoViolencia = True
                        self.msjGanaste.visible = False
                        self.tablero.sonido.play(-1)
                        salir = True
                        self.tablero.run()
                    
                    if self.cursor.colliderect(self.areaRojo):
                        color = "Rojo"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Rojo.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))
                        
                        if area is not None:
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = False    
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = False
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = False
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = False
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = False
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = True
                        
                        
                    elif self.cursor.colliderect(self.areaAmarillo):
                        color = "Amarillo"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Amarillo.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))

                        if area is not None:
                        
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = False
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = True
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = False
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = False
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = False
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = False
                    
                    elif self.cursor.colliderect(self.areaAzul):
                        color = "Azul"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Azul.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))

                        if area is not None:
                        
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = False
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = False
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = False
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = True
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = False
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = False
                    
                    elif self.cursor.colliderect(self.areaMorado):
                        color = "Morado"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Morado.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))

                        if area is not None:
                        
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = False
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = False
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = False
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = False
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = True
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = False
                        
                    elif self.cursor.colliderect(self.areaNaranja):
                        color = "Naranja"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Naranja.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))

                        if area is not None:
                        
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = True
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = False
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = False
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = False
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = False
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = False
                        
                    elif self.cursor.colliderect(self.areaVerde):
                        color = "Verde"
                        # print "Click en ", color
                        ancho = 24
                        self.imgPincel = Servicios.cargarImagen("Pincel_Verde.png", self.dirImagenes)
                        altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
                        self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))

                        if area is not None:
                        
                            if area == 1:
                                imgArea1 = Servicios.cargarImagen("Mandala_%s_Naranja_%s.png" % (self.tipo, color), self.dirImagenes)
                                area1Correcto = False
                            elif area == 2:
                                imgArea2 = Servicios.cargarImagen("Mandala_%s_Amarillo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area2Correcto = False
                            elif area == 3:
                                imgArea3 = Servicios.cargarImagen("Mandala_%s_Verde_%s.png" % (self.tipo, color), self.dirImagenes)
                                area3Correcto = True
                            elif area == 4:
                                imgArea4 = Servicios.cargarImagen("Mandala_%s_Azul_%s.png" % (self.tipo, color), self.dirImagenes)
                                area4Correcto = False
                            elif area == 5:
                                imgArea5 = Servicios.cargarImagen("Mandala_%s_Morado_%s.png" % (self.tipo, color), self.dirImagenes)
                                area5Correcto = False
                            elif area == 6:
                                imgArea6 = Servicios.cargarImagen("Mandala_%s_Rojo_%s.png" % (self.tipo, color), self.dirImagenes)
                                area6Correcto = False
                        
                    elif self.cursor.colliderect(self.btnArea1.rect):
                        area = 1
                        # print "Click en area", area
                        
                    elif self.cursor.colliderect(self.btnArea2.rect):
                        area = 2
                        # print "Click en area", area 
                        
                    elif self.cursor.colliderect(self.btnArea3.rect):
                        area = 3
                        # print "Click en area", area    
                        
                    elif self.cursor.colliderect(self.btnArea4.rect):
                        area = 4
                        # print "Click en area", area  
                        
                    elif self.cursor.colliderect(self.btnArea5.rect):
                        area = 5
                        # print "Click en area", area      
                        
                    elif self.cursor.colliderect(self.btnArea6.rect):
                        area = 6
                        # print "Click en area", area
                                
                    
            self.clock.tick(60)
            
            self.screen.blit(fondo, (0, 0))
            
            self.cursor.update()
            
            self.msjInicio.update(self.screen, self.cursor)
            self.msjGanaste.update(self.screen, self.cursor)
            
            if inicio:
                self.msjInicio.visible = True
                self.btnRegresar.update(self.screen, self.cursor)
            
            
            elif juego:
            
                if pasoSilencio == False:
                    
                    # pygame.mouse.set_visible(True)
                    
                    # self.screen.blit(self.imgColor, (0, 0))
                    
                    #self.screen.blit(fondo, (0, 0))
                    
                    #self.btnRegresar.update(self.screen, self.cursor)
                    
                    # THRESHOLD = 1500
                    # CHUNK_SIZE = 1024
                    # FORMAT = pyaudio.paInt16
                    # RATE = 44100
                
                    # p = pyaudio.PyAudio()
                    # stream = p.open(format=FORMAT, channels=1, rate=RATE,
                    # input=True, output=True,
                    # frames_per_buffer=CHUNK_SIZE)
            
                    # r = array('h')
                    
                    # a 60 FPS 600 frames equivalen a 10 segundos
                    
                    t = time.time()
            
                    while segundos <= 10:
                        
                        self.clock.tick(60)
                        
                        self.screen.blit(fondo, (0, 0))
                    
                        self.btnRegresar.update(self.screen, self.cursor)
                        
                        self.cursor.update()
                        
                        # little endian, signed short
                        # snd_data = array('h', stream.read(CHUNK_SIZE))
                        # if byteorder == 'big':
                            # snd_data.byteswap()
                        # r.extend(snd_data)
                            
                        # 'True' if below the 'silent' threshold
                        # silencio = max(snd_data) < THRESHOLD
                        
                        # silencio = True
                        
                        # if silencio == False:
                            # t = time.time()
    
                        # self.screen.fill(self.color)
                        
                        
                        
                        self.screen.blit(self.imgColor, (self.x, self.y))
                        
                        texto = self.fuenteGrande.render("Observa la mandala en silencio durante 10 segundos", 1, (255, 255, 255))
                        
                        textoSeg = self.fuenteGrande.render(str("Segundos restantes: %d" % (10 - segundos)), 1, (255, 255, 255))
                        
                        self.screen.blit(texto, (10, 10))
                        self.screen.blit(textoSeg, (10, 770))
                        
                        self.btnRegresar.update(self.screen, self.cursor)
                        
                        #self.screen.blit(self.imgPincel, self.cursor)
                        
                        pygame.display.update()
                        
                        segundos = time.time() - t
                        segundos = int(segundos)
                        
                        for event in pygame.event.get():
                            if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                            
                                if self.cursor.colliderect(self.btnRegresar.rect):
                                    pygame.mouse.set_visible(True)
                                    segundos = 11
                                    salir = True
                                    self.tablero.sonido.play(-1)
                                    self.tablero.run()
                            
                    pasoSilencio = True
    
                
                # self.cursor.update()
                
                # self.screen.blit(fondo, (0, 0))
                
                
                pygame.mouse.set_visible(False)  # hace al mouse invisible
                
                self.screen.blit(self.imgSinColor, (self.x, self.y))
                
                
                self.btnRegresar.update(self.screen, self.cursor)
                self.btnAyuda.update(self.screen, self.cursor)
                
                self.btnArea1.update(self.screen, self.cursor)
                self.btnArea2.update(self.screen, self.cursor)
                self.btnArea3.update(self.screen, self.cursor)
                self.btnArea4.update(self.screen, self.cursor)
                self.btnArea5.update(self.screen, self.cursor)
                self.btnArea6.update(self.screen, self.cursor)
                
                # self.btnColorear.update(self.screen, self.cursor)
                
                if self.cursor.colliderect(self.areaRojo):
                    self.screen.blit(self.imgRojoSelec, (self.x, self.y))
                    
                if self.cursor.colliderect(self.areaAmarillo):
                    self.screen.blit(self.imgAmarilloSelec, (self.x, self.y))
                    
                if self.cursor.colliderect(self.areaAzul):
                    self.screen.blit(self.imgAzulSelec, (self.x, self.y))
                    
                if self.cursor.colliderect(self.areaMorado):
                    self.screen.blit(self.imgMoradoSelec, (self.x, self.y))
                    
                if self.cursor.colliderect(self.areaNaranja):
                    self.screen.blit(self.imgNaranjaSelec, (self.x, self.y))
                    
                if self.cursor.colliderect(self.areaVerde):
                    self.screen.blit(self.imgVerdeSelec, (self.x, self.y)) 
                
                
                if imgArea1 != None:
                    self.screen.blit(imgArea1, (self.x, self.y))
                    
                if imgArea2 != None:
                    self.screen.blit(imgArea2, (self.x, self.y))
                    
                if imgArea3 != None:
                    self.screen.blit(imgArea3, (self.x, self.y))
                    
                if imgArea4 != None:
                    self.screen.blit(imgArea4, (self.x, self.y))
                    
                if imgArea5 != None:
                    self.screen.blit(imgArea5, (self.x, self.y))
                    
                if imgArea6 != None:
                    self.screen.blit(imgArea6, (self.x, self.y))
                
                    
                if area == 1:
                    self.screen.blit(self.imgNaranjaSel, (self.x, self.y))
                    
                if area == 2:
                    self.screen.blit(self.imgAmarilloSel, (self.x, self.y))
                    
                if area == 3:
                    self.screen.blit(self.imgVerdeSel, (self.x, self.y))
                
                if area == 4:
                    self.screen.blit(self.imgAzulSel, (self.x, self.y))
                    
                if area == 5:
                    self.screen.blit(self.imgMoradoSel, (self.x, self.y))
                    
                if area == 6:
                    self.screen.blit(self.imgRojoSel, (self.x, self.y))
                    
                
                self.screen.blit(textoColorear, (10, 10))
                
                '''
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaRojo, 2)
                
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaAmarillo, 2)
                
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaAzul, 2)
                
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaMorado, 2)
                
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaNaranja, 2)
                
                pygame.draw.rect (self.screen , (100, 100, 100) , self.areaVerde, 2)
                '''
        # gano    
                if area1Correcto and area2Correcto and area3Correcto and area4Correcto and area5Correcto and area6Correcto:
                    
                    # self.tablero.sonidoExito.play()
                    
                    # textoPaso = self.fuenteGrande.render(str("!Has coloreado la mandala correctamente!"), 1, (255, 255, 255))
                    # self.screen.blit(textoPaso, (10, 770))
                    # pygame.display.update()
                    # pygame.time.delay(2000)
                    
                    # self.tablero.sonido.play(-1)
                    juego = False
                    gano = True
                    
                    
                    
                    
                    #self.tablero.run()
                    
                
                if self.cursor.left > 0 and self.cursor.left < self.ancho and self.cursor.top > 0 and self.cursor.top < self.alto:
                    self.screen.blit(self.imgPincel, self.cursor)
                    
            elif gano:
                
                pygame.mouse.set_visible(True)
                
                if pasoSonidoExito == False:
                    self.tablero.sonidoExito.play()
                    pasoSonidoExito = True
                
                self.msjGanaste.visible = True
                
            
            pygame.display.update()
Ejemplo n.º 18
0
    def __init__(self, cursor, screen, clock, padre):
        self.cursor = cursor
        bif = os.path.join("imagenes", "verdad")
        resource.set_images_path(bif)
        self.background = resource.get_image("fondoPacman.png", False)

        self.estrella = resource.get_image("star.png", False)

        self.screen = screen
        self.clock = clock

        self.tablero = padre

        self.audio = Servicios.cargarSonido("verdad.ogg",
                                            os.path.join("audios", "cuentos"))

        self.inicioPoderoso = None

        # self.cita = fraseVerdad.FraseVerdad(self.screen, self.clock, self.cursor, self.tablero)

        self.mouse = Cursor.Mouse()
        #self.botonReintentar = Boton.BotonReintentar()
        #self.botonContinuar = Boton.BotonContinuar()
        #self.botonTerminar = Boton.BotonTerminar()

        self.msjInicio = MensajeEmergente.MensajeInicial(30, "CuentoVerdad")
        self.msjGanaste = MensajeEmergente.MensajeGanaste(28, "JuegoVerdad")
        self.msjPerdiste = MensajeEmergente.MensajePerdiste(28, "JuegoVerdad")

        # self.instrucciones = pygame.image.load(os.path.join("imagenes", "verdad", "inicioVerdad.png")).convert_alpha()
        # self.letrero = pygame.image.load(os.path.join("imagenes", "verdad", "ganastePacman.png")).convert_alpha()
        #self.letreroReintento = resource.get_image("perdistePacman.png")).convert_alpha()

        self.inicio = True
        self.juego = False
        self.terminar = False
        self.gano = False
        self.perdio = False
        self.numMonedas = 0

        self.personaje = Personaje.PersonajePacman((0, 0),
                                                   self.tablero.personaje.sexo)

        self.loadSprites()

        self.monstruos = pygame.sprite.Group()
        monstruo1V = monstruo1.Monstruo1()
        self.monstruos.add(monstruo1V)
        monstruo2V = monstruo2.Monstruo2()
        self.monstruos.add(monstruo2V)
        monstruo3V = monstruo3.Monstruo3()
        self.monstruos.add(monstruo3V)

        self.bloques.draw(self.background)

        resource.set_images_path(os.path.join("imagenes"))
        imgBtnRegresar = resource.get_image("boton_regresar.png")
        imgBtnRegresarSelec = resource.get_image("boton_regresar_selec.png")

        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (1200 - 214 - 10), 10)
Ejemplo n.º 19
0
 def __init__(self, cursor, screen, clock, anchoVentana, altoVentana, tipo, padre):
     '''
     1:"Flor"  
     2:"Hojas"  
     3:"Nino"
     4:"Sol"
     5:"Flor2"
     '''
     self.tipo = tipo
     
     self.ancho = anchoVentana
     self.alto = altoVentana
     self.cursor = Cursor.Cursor()
     
     self.cursor2 = cursor
     
     self.screen = screen
     self.clock = clock
     self.tablero = padre
     
     self.initFont()
     
     self.paz = None
     self.amor = None
     self.rectitud = None
     self.verdad = None
     self.noViolencia = None
     
     self.msjInicio = MensajeEmergente.MensajeInicial(40, "Silencio")
     self.msjGanaste = MensajeEmergente.MensajeGanaste(28, "Silencio")
     
     self.dirImagenes = os.path.join("imagenes", "mandalas")
     
     self.imgColor = Servicios.cargarImagen("Mandala_%s.png" % (self.tipo), self.dirImagenes)
     
     self.imgSinColor = Servicios.cargarImagen("Mandala_%s_ByN.png" % (self.tipo), self.dirImagenes)
     
     self.imgRojoSelec = Servicios.cargarImagen("Paleta_Rojo_Selec.png", self.dirImagenes)
     
     self.imgAmarilloSelec = Servicios.cargarImagen("Paleta_Amarillo_Selec.png", self.dirImagenes)
     
     self.imgAzulSelec = Servicios.cargarImagen("Paleta_Azul_Selec.png", self.dirImagenes)
     
     self.imgMoradoSelec = Servicios.cargarImagen("Paleta_Morado_Selec.png", self.dirImagenes)
     
     self.imgNaranjaSelec = Servicios.cargarImagen("Paleta_Naranja_Selec.png", self.dirImagenes)
     
     self.imgVerdeSelec = Servicios.cargarImagen("Paleta_Verde_Selec.png", self.dirImagenes)
     
     ancho = 24
     self.imgPincel = Servicios.cargarImagen("Pincel.png", self.dirImagenes)
     altoImg = ancho * self.imgPincel.get_height() / self.imgPincel.get_width()
     self.imgPincel = pygame.transform.smoothscale(self.imgPincel, (ancho, altoImg))
     
     self.imgRojoSel = Servicios.cargarImagen("Mandala_%s_Rojo_Seleccionado.png" % (self.tipo), self.dirImagenes)
     
     self.imgAmarilloSel = Servicios.cargarImagen("Mandala_%s_Amarillo_Seleccionado.png" % (self.tipo), self.dirImagenes)
     
     self.imgAzulSel = Servicios.cargarImagen("Mandala_%s_Azul_Seleccionado.png" % (self.tipo), self.dirImagenes)
     
     self.imgMoradoSel = Servicios.cargarImagen("Mandala_%s_Morado_Seleccionado.png" % (self.tipo), self.dirImagenes)
     
     self.imgNaranjaSel = Servicios.cargarImagen("Mandala_%s_Naranja_Seleccionado.png" % (self.tipo), self.dirImagenes)
     
     self.imgVerdeSel = Servicios.cargarImagen("Mandala_%s_Verde_Seleccionado.png" % (self.tipo), self.dirImagenes)
    
     self.x = self.ancho - (self.ancho / 2) - (self.imgColor.get_width() / 2)
     self.y = self.alto - (self.alto / 2) - (self.imgColor.get_height() / 2) - 20
     
     sumarAX = self.x
     sumarAY = self.y
     
     self.areaRojo = Rect(750 + sumarAX, 165 + sumarAY, 44, 44) 
     self.areaAmarillo = Rect(745 + sumarAX, 115 + sumarAY, 44, 44) 
     self.areaAzul = Rect(773 + sumarAX, 76 + sumarAY, 44, 41) 
     self.areaMorado = Rect(820 + sumarAX, 65 + sumarAY, 44, 44) 
     self.areaNaranja = Rect(868 + sumarAX, 85 + sumarAY, 44, 44) 
     self.areaVerde = Rect(883 + sumarAX, 137 + sumarAY, 44, 44) 
       
     xBotones = 850
     yInicial = 380
     deltaY = 70
     
     imgBtnArea1 = Servicios.cargarImagen("boton_area1.png", self.dirImagenes)
     imgBtnArea1Selec = Servicios.cargarImagen("boton_area1_selec.png", self.dirImagenes)
     
     self.btnArea1 = Boton.Boton(imgBtnArea1, imgBtnArea1Selec, xBotones, yInicial)
     
     imgBtnArea2 = Servicios.cargarImagen("boton_area2.png", self.dirImagenes)
     imgBtnArea2Selec = Servicios.cargarImagen("boton_area2_selec.png", self.dirImagenes)
     
     self.btnArea2 = Boton.Boton(imgBtnArea2, imgBtnArea2Selec, xBotones, yInicial + deltaY)
     
     imgBtnArea3 = Servicios.cargarImagen("boton_area3.png", self.dirImagenes)
     imgBtnArea3Selec = Servicios.cargarImagen("boton_area3_selec.png", self.dirImagenes)
     
     self.btnArea3 = Boton.Boton(imgBtnArea3, imgBtnArea3Selec, xBotones, yInicial + 2 * deltaY)
     
     imgBtnArea4 = Servicios.cargarImagen("boton_area4.png", self.dirImagenes)
     imgBtnArea4Selec = Servicios.cargarImagen("boton_area4_selec.png", self.dirImagenes)
     
     self.btnArea4 = Boton.Boton(imgBtnArea4, imgBtnArea4Selec, xBotones, yInicial + 3 * deltaY)
     
     imgBtnArea5 = Servicios.cargarImagen("boton_area5.png", self.dirImagenes)
     imgBtnArea5Selec = Servicios.cargarImagen("boton_area5_selec.png", self.dirImagenes)
     
     self.btnArea5 = Boton.Boton(imgBtnArea5, imgBtnArea5Selec, xBotones, yInicial + 4 * deltaY)
     
     imgBtnArea6 = Servicios.cargarImagen("boton_area6.png", self.dirImagenes)
     imgBtnArea6Selec = Servicios.cargarImagen("boton_area6_selec.png", self.dirImagenes)
  
     self.btnArea6 = Boton.Boton(imgBtnArea6, imgBtnArea6Selec, xBotones, yInicial + 5 * deltaY)
     
     imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png", "imagenes")
     imgBtnRegresarSelec = Servicios.cargarImagen("boton_regresar_selec.png", "imagenes")
     
     self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (self.ancho - 214 - 10), 10)
     
     imgBtnAyuda = Servicios.cargarImagen("BotonesAyuda.png", os.path.join("imagenes", "citas"))
     imgBtnAyudaSelec = Servicios.cargarImagen("BotonesAyuda_selec.png", os.path.join("imagenes", "citas"))
     
     self.btnAyuda = Boton.Boton(imgBtnAyuda, imgBtnAyudaSelec, 5, 750)
Ejemplo n.º 20
0
    def __init__(self, ventPadre, cursor, screen, clock, anchoVentana, altoVentana):
        
        self.compartir = compartir.Compartir(screen, cursor, clock, self)
        
        self.menu = ventPadre
        
        self.ancho = anchoVentana
        self.alto = altoVentana
        
        self.msjInicio = MensajeEmergente.MensajeInicial(40, "Tablero")
        
        self.personaje = self.menu.personaje
        
        self.mandala = None
        self.cuento = None
        self.cita = None
        self.canto = None

        self.sonido = self.menu.musicaMenu
        
        self.audio = Servicios.cargarSonido("intro.ogg", os.path.join("audios", "cuentos"))
        
        # cargo a memoria los audios
        resource.set_sounds_path(os.path.join("audios"))
        self.sonidoAmor = resource.get_sound("amor_instrum.ogg")
        self.sonidoRectitud = resource.get_sound("rectitud_instrum.ogg")
        self.sonidoPaz = resource.get_sound("paz_instrum.ogg")
        self.sonidoVerdad = resource.get_sound("verdad_instrum.ogg")
        self.sonidoNoViolencia = resource.get_sound("noViolencia_instrum.ogg")
        # self.sonido2=resource.get_sound("verdad_instrum.ogg")
        self.sonido2 = None
        
        
        # self.sonidoExito = Servicios.cargarSonido("exito.wav", "audios")
        self.sonidoExito = resource.get_sound("exito.wav")
        
        self.dirImagenes = os.path.join("imagenes", "tableroCentral")
        
        resource.set_images_path(self.dirImagenes)
        
        # self.background = Servicios.cargarImagen("Mandala_Tablero_Blanco.png", self.dirImagenes)
        # self.imagenPaz = Servicios.cargarImagen("Mandala_Tablero_Paz.png", self.dirImagenes)
        # self.imagenPazSel = Servicios.cargarImagen("Mandala_Tablero_Paz_Seleccionado.png", self.dirImagenes)
        # self.imagenAmor = Servicios.cargarImagen("Mandala_Tablero_Amor.png", self.dirImagenes)
        # self.imagenAmorSel = Servicios.cargarImagen("Mandala_Tablero_Amor_Seleccionado.png", self.dirImagenes)
        # self.imagenRectitud = Servicios.cargarImagen("Mandala_Tablero_Rectitud.png", self.dirImagenes)
        # self.imagenRectitudSel = Servicios.cargarImagen("Mandala_Tablero_Rectitud_Seleccionado.png", self.dirImagenes)
        # self.imagenVerdad = Servicios.cargarImagen("Mandala_Tablero_Verdad.png", self.dirImagenes)
        # self.imagenVerdadSel = Servicios.cargarImagen("Mandala_Tablero_Verdad_Seleccionado.png", self.dirImagenes)
        # self.imagenNoViolencia = Servicios.cargarImagen("Mandala_Tablero_NoViolencia.png", self.dirImagenes)
        # self.imagenNoViolenciaSel = Servicios.cargarImagen("Mandala_Tablero_NoViolencia_Seleccionado.png", self.dirImagenes)
        # self.candadoRectitud = Servicios.cargarImagen("candado_rectitud.png", self.dirImagenes)
        # self.candadoPaz = Servicios.cargarImagen("candado_paz.png", self.dirImagenes)
        # self.candadoVerdad = Servicios.cargarImagen("candado_verdad.png", self.dirImagenes)
        # self.candadoNoViolencia = Servicios.cargarImagen("candado_noviolencia.png", self.dirImagenes)
        
        self.background = resource.get_image("Mandala_Tablero_Blanco.png")
        self.imagenPaz = resource.get_image("Mandala_Tablero_Paz.png")
        self.imagenPazSel = resource.get_image("Mandala_Tablero_Paz_Seleccionado.png")
        self.imagenAmor = resource.get_image("Mandala_Tablero_Amor.png")
        self.imagenAmorSel = resource.get_image("Mandala_Tablero_Amor_Seleccionado.png")
        self.imagenRectitud = resource.get_image("Mandala_Tablero_Rectitud.png")
        self.imagenRectitudSel = resource.get_image("Mandala_Tablero_Rectitud_Seleccionado.png")
        self.imagenVerdad = resource.get_image("Mandala_Tablero_Verdad.png")
        self.imagenVerdadSel = resource.get_image("Mandala_Tablero_Verdad_Seleccionado.png")
        self.imagenNoViolencia = resource.get_image("Mandala_Tablero_NoViolencia.png")
        self.imagenNoViolenciaSel = resource.get_image("Mandala_Tablero_NoViolencia_Seleccionado.png")
        self.candadoRectitud = resource.get_image("candado_rectitud.png")
        self.candadoPaz = resource.get_image("candado_paz.png")
        self.candadoVerdad = resource.get_image("candado_verdad.png")
        self.candadoNoViolencia = resource.get_image("candado_noviolencia.png")
        
        self.cursor = cursor
        self.screen = screen
        self.clock = clock
        
        self.pasoSilencioAmor = False
        self.pasoCuentoAmor = False
        self.pasoCitaAmor = False
        self.pasoCantoAmor = False
        self.pasoAmor = False
        
        self.pasoSilencioRectitud = False
        self.pasoCuentoRectitud = False
        self.pasoCitaRectitud = False
        self.pasoCantoRectitud = False
        self.pasoRectitud = False
        
        self.pasoSilencioPaz = False
        self.pasoCuentoPaz = False
        self.pasoCitaPaz = False
        self.pasoCantoPaz = False
        self.pasoPaz = False
        
        self.pasoSilencioVerdad = False
        self.pasoCuentoVerdad = False
        self.pasoCitaVerdad = False
        self.pasoCantoVerdad = False
        self.pasoVerdad = False
        
        self.pasoSilencioNoViolencia = False
        self.pasoCuentoNoViolencia = False
        self.pasoCitaNoViolencia = False
        self.pasoCantoNoViolencia = False
        self.pasoNoViolencia = False
        
        sumarAX = 100
        sumarAY = 63
        
        x = 431 + sumarAX
        y = 50 + 5 + sumarAY
        anch = 141
        alt = 141
        self.areaPaz = Rect(x, y, anch, alt) 
        
        x = 643 + sumarAX
        y = 197 + 15 + sumarAY
        anch = 141
        alt = 141
        self.areaRectitud = Rect(x, y, anch, alt) 
        
        x = 558 + sumarAX
        y = 430 + 30 + sumarAY
        anch = 141
        alt = 141
        self.areaAmor = Rect(x, y, anch, alt) 
        
        x = 297 + sumarAX
        y = 430 + 30 + sumarAY
        anch = 141
        alt = 141
        self.areaNoViolencia = Rect(x, y, anch, alt) 
        
        x = 216 + sumarAX
        y = 197 + 15 + sumarAY
        anch = 141
        alt = 141
        self.areaVerdad = Rect(x, y, anch, alt)    
        
        # imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png", "imagenes")
        # imgBtnRegresarSelec = Servicios.cargarImagen("boton_regresar_selec.png", "imagenes")
        
        resource.set_images_path(os.path.join("imagenes"))
        imgBtnRegresar = resource.get_image("boton_regresar.png")
        imgBtnRegresarSelec = resource.get_image("boton_regresar_selec.png")
        
        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (self.ancho - 214 - 10), 10)
        
        self.initFont()
        
        self.intro = True
        self.msjInicio = MensajeEmergente.MensajeInicial(40, "Tablero")
Ejemplo n.º 21
0
    def __init__(self, cursor, screen, clock, padre):
        
        self.dirImagenes = os.path.join("imagenes", "paz")
        self.tablero = padre
        


        self.semillasFactory = semillasFactory.SemillasFactory()
        self.plantasFactory = plantasFactory.PlantasFactory()
        self.background = Servicios.cargarImagen("fondo_paz.png", self.dirImagenes, False)
        
        # anchoImg = self.tablero.ancho + 47
        # altoImg = anchoImg * self.background.get_height() / self.background.get_width()
        # self.background = pygame.transform.smoothscale(self.background, (anchoImg, altoImg))
        
        self.screen = screen
        self.clock = clock
        self.cursor = cursor
        
        self.audio = Servicios.cargarSonido("paz.ogg", os.path.join("audios", "cuentos"))
        
        # self.cita = frasePaz.FrasePaz(self.screen, self.clock, self.cursor, self.tablero)
        
        #nuevo----------------
        
        self.botonContinuar = Boton.BotonContinuar()
        self.botonTerminar = Boton.BotonTerminar()
        
        self.msjInicio = MensajeEmergente.MensajeInicial(40, "CuentoPaz")
        self.msjGanaste = MensajeEmergente.MensajeGanaste(28, "JuegoPaz")
        
        #self.instrucciones = pygame.image.load(os.path.join("imagenes", "paz", "inicioPaz.png")).convert_alpha()
        #self.letrero = pygame.image.load(os.path.join("imagenes", "paz", "ganaste.png")).convert_alpha()
        #self.letreroReintento = pygame.image.load(os.path.join("imagenes", "paz", "PerdistePaz.png")).convert_alpha()
        #self.transparente = pygame.image.load(os.path.join("imagenes", "transparente.png")).convert_alpha()
        
        
        
        self.mouse = Cursor.Mouse()
        
        
        
        #-------------------------

        self.x = 0
        self.orden = []
        self.texto = True 

        self.fuente1 = pygame.font.Font(None, 24)
        self.texto1 = self.fuente1.render(" Ahora  este lugar esta limpio pero no hay arboles ni flores, por eso vas       ", 0, (255, 230, 245), (50, 50, 50))
        self.texto2 = self.fuente1.render(" a sembrar semillas. estas van a aparecer con un numero, que debes           ", 0, (255, 230, 245), (50, 50, 50))
        self.texto3 = self.fuente1.render(" memorizar. para que queden sembradas debes darle click al numero        ", 0, (255, 230, 245), (50, 50, 50))
        self.texto4 = self.fuente1.render(" de cada semilla  de forma ascendente. A medida que vayas sembrando,    ", 0, (255, 230, 245), (50, 50, 50))
        self.texto5 = self.fuente1.render(" mas semillas van a aparecer, y debes irlas sembrando para llenar al           ", 0, (255, 230, 245), (50, 50, 50))
        self.texto6 = self.fuente1.render(" bosque de arboles otra vez.                                                                                   ", 0, (255, 230, 245), (50, 50, 50))
        self.texto7 = self.fuente1.render(" Perdiste, intenta de nuevo", 0, (255, 230, 245), (50, 50, 50))
        self.texto8 = self.fuente1.render(" Ganaste", 0, (255, 230, 245), (50, 50, 50))

        self.puntaje = 5000

        self.semilla1 = self.semillasFactory.getSemilla()
        self.semilla2 = self.semillasFactory.getSemilla()
        self.semilla3 = self.semillasFactory.getSemilla()
        self.semilla4 = self.semillasFactory.getSemilla()
        self.semilla5 = self.semillasFactory.getSemilla()
        self.semilla6 = self.semillasFactory.getSemilla()
        self.semilla7 = self.semillasFactory.getSemilla()
        
        self.planta1 = self.plantasFactory.getPlanta()
        self.planta1.rect.x = Servicios.reajustarCoord(5, self.tablero.alto, 1000)
        self.planta1.rect.y = Servicios.reajustarCoord(350, self.tablero.alto, 700)
        self.planta2 = self.plantasFactory.getPlanta()
        self.planta2.rect.x = Servicios.reajustarCoord(110, self.tablero.alto, 1000)
        self.planta2.rect.y = Servicios.reajustarCoord(450, self.tablero.alto, 700)
        self.planta3 = self.plantasFactory.getPlanta()
        self.planta3.rect.x = Servicios.reajustarCoord(500, self.tablero.alto, 1000)
        self.planta3.rect.y = Servicios.reajustarCoord(300, self.tablero.alto, 700)
        self.planta4 = self.plantasFactory.getPlanta()
        self.planta4.rect.x = Servicios.reajustarCoord(330, self.tablero.alto, 1000)
        self.planta4.rect.y = Servicios.reajustarCoord(400, self.tablero.alto, 700)
        self.planta5 = self.plantasFactory.getPlanta()
        self.planta5.rect.x = Servicios.reajustarCoord(350, self.tablero.alto, 1000)
        self.planta5.rect.y = Servicios.reajustarCoord(250, self.tablero.alto, 700)
        self.planta6 = self.plantasFactory.getPlanta()
        self.planta6.rect.x = Servicios.reajustarCoord(200, self.tablero.alto, 1000)
        self.planta6.rect.y = Servicios.reajustarCoord(350, self.tablero.alto, 700)


        self.vamos3 = True
        self.vamos5 = False
        self.vamos7 = False
        self.termino = False
        self.termino2 = 1
        
        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png", "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen("boton_regresar_selec.png", "imagenes")
        
        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (1200 - 214 - 10), 10)
Ejemplo n.º 22
0
    def __init__(self, x, y, anch, caneca):
        self.x = x
        self.y = y
        self.ancho = anch

        self.x2 = x
        self.y2 = y
        self.ancho2 = anch

        self.xInfo = x
        self.yInfo = y
        self.anchoInfo = anch

        self.caneca = caneca
        self.dirImagenes = os.path.join("imagenes", "rectitud", "canecas")

        if caneca == 1:
            self.imagenOriginal = Servicios.cargarImagen(
                "caneca_azul.png", self.dirImagenes)
            self.imagenOriginalInfo = Servicios.cargarImagen(
                "caneca_azul_info.png", self.dirImagenes)
        if caneca == 2:
            self.imagenOriginal = Servicios.cargarImagen(
                "caneca_blanca.png", self.dirImagenes)
            self.imagenOriginalInfo = Servicios.cargarImagen(
                "caneca_blanca_info.png", self.dirImagenes)
        if caneca == 3:
            self.imagenOriginal = Servicios.cargarImagen(
                "caneca_gris.png", self.dirImagenes)
            self.imagenOriginalInfo = Servicios.cargarImagen(
                "caneca_gris_info.png", self.dirImagenes)

        self.imagen = self.imagenOriginal

        self.alto = self.ancho * self.imagenOriginal.get_height(
        ) / self.imagenOriginal.get_width()

        self.imagen = pygame.transform.smoothscale(self.imagenOriginal,
                                                   (self.ancho, self.alto))

        self.rect = self.imagen.get_rect()
        self.rect.left, self.rect.top = (self.x, self.y)

        self.imagen2 = self.imagenOriginal

        self.alto2 = self.ancho2 * self.imagenOriginal.get_height(
        ) / self.imagenOriginal.get_width()

        self.imagen2 = pygame.transform.smoothscale(self.imagenOriginal,
                                                    (self.ancho2, self.alto2))

        self.rect2 = self.imagen2.get_rect()
        self.rect2.left, self.rect2.top = (self.x2, self.y2)

        self.imagenInfo = self.imagenOriginalInfo

        self.altoInfo = self.anchoInfo * self.imagenOriginalInfo.get_height(
        ) / self.imagenOriginalInfo.get_width()

        self.imagenInfo = pygame.transform.smoothscale(
            self.imagenOriginalInfo, (self.anchoInfo, self.altoInfo))

        self.rectInfo = self.imagenInfo.get_rect()
        self.rectInfo.left, self.rectInfo.top = (self.xInfo, self.yInfo)
Ejemplo n.º 23
0
 def run(self):
     
     fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"), False)
     logo = Servicios.cargarImagen("logo.png", self.dirImagenes)
     
     salir = False
     
     #imgLetrero = Servicios.cargarImagen("Pantalla_Citas.png", self.dirImagenes)
     
     #msj = MensajeEmergente.MensajeInicial(40, "CuentoNoViolencia")
     
     #msj = MensajeEmergente.MensajeGanaste(28, "JuegoNoViolencia")
     
     msj = MensajeEmergente.MensajeInicial(40, "CuentoNoViolencia")
     msj2 = MensajeEmergente.MensajeInicial(40, "CuentoNoViolencia")
     
     while salir == False:
         for event in pygame.event.get():
             if event.type == QUIT:
                 pygame.quit()
                 sys.exit()
             
             if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                 
                 if self.cursor.colliderect(msj.btn.rect):
                     msj.setVisible(False)
                     
                 if self.cursor.colliderect(msj2.btn.rect):
                     msj2.setVisible(False)
                 
                 if self.cursor.colliderect(self.btnJugar.rect):
                     msj.setVisible(True)
                 
                 if self.cursor.colliderect(self.btnAprender.rect):
                     msj2.setVisible(True)
                 
                 if self.cursor.colliderect(self.btnSalir.rect):
                     salir = True
                     pygame.quit()
                     sys.exit()
                     
         self.clock.tick(60)
         
         self.cursor.update()
         
         self.screen.blit(fondo, (0, 0))
         self.screen.blit(logo, (0, 0))
         
         #===================================================================
         # if emergenteVisible:
         #    msj.setText("Esta es una ventana emergente de prueba. Este es un texto muy largo!")
         #    self.screen.blit(msj.image, (msj.x, msj.y))
         #===================================================================
         
         
            
         self.btnJugar.update(self.screen, self.cursor)
         self.btnAprender.update(self.screen, self.cursor)
         self.btnSalir.update(self.screen, self.cursor)
         
         msj.update(self.screen, self.cursor)
         
         pygame.display.update()
Ejemplo n.º 24
0
    def __init__(self, x, y, ancho, tipo):

        self.dirImagenes = os.path.join("imagenes", "amor", "monstruossucios")
        self.tipo = tipo
        self.x = x
        self.y = y
        self.ancho = ancho
        self.alfa = 0
        self.auxAlfa = 0
        self.imagen1 = Servicios.cargarImagen("monstruo1.png",
                                              self.dirImagenes)
        self.alto = self.ancho * self.imagen1.get_height(
        ) / self.imagen1.get_width()
        self.vivo = True
        self.controlDibujo = 0
        self.auxControlDibujo = 0

        if self.tipo == 1:
            self.imagen1 = Servicios.cargarImagen("monstruo1.png",
                                                  self.dirImagenes)
            self.imagen2 = Servicios.cargarImagen("monstruo1B.png",
                                                  self.dirImagenes)
            self.imagen3 = Servicios.cargarImagen("monstruo1C.png",
                                                  self.dirImagenes)
            self.imagen4 = Servicios.cargarImagen("monstruo1D.png",
                                                  self.dirImagenes)
            self.imagen5 = Servicios.cargarImagen("monstruo1E.png",
                                                  self.dirImagenes)
            self.imagen6 = Servicios.cargarImagen("monstruo1F.png",
                                                  self.dirImagenes)

        if self.tipo == 2:
            self.imagen1 = Servicios.cargarImagen("monstruo2.png",
                                                  self.dirImagenes)
            self.imagen2 = Servicios.cargarImagen("monstruo2B.png",
                                                  self.dirImagenes)
            self.imagen3 = Servicios.cargarImagen("monstruo2C.png",
                                                  self.dirImagenes)
            self.imagen4 = Servicios.cargarImagen("monstruo2D.png",
                                                  self.dirImagenes)
            self.imagen5 = Servicios.cargarImagen("monstruo2E.png",
                                                  self.dirImagenes)
            self.imagen6 = Servicios.cargarImagen("monstruo2F.png",
                                                  self.dirImagenes)

        if self.tipo == 3:
            self.imagen1 = Servicios.cargarImagen("monstruo3.png",
                                                  self.dirImagenes)
            self.imagen2 = Servicios.cargarImagen("monstruo3B.png",
                                                  self.dirImagenes)
            self.imagen3 = Servicios.cargarImagen("monstruo3C.png",
                                                  self.dirImagenes)
            self.imagen4 = Servicios.cargarImagen("monstruo3D.png",
                                                  self.dirImagenes)
            self.imagen5 = Servicios.cargarImagen("monstruo3E.png",
                                                  self.dirImagenes)
            self.imagen6 = Servicios.cargarImagen("monstruo3F.png",
                                                  self.dirImagenes)

        self.imagen_actual = self.imagen1
        self.rect = self.imagen_actual.get_rect()
        self.rect.left, self.rect.top = (self.x, self.y)
Ejemplo n.º 25
0
    def run(self):
        
        # pygame.mouse.set_visible(True)
        
        inicio = True
        juego = False
        gano = False
        
        
        pasoSonidoExito = False
        
        objetosN1 = Servicios.cargarImagen("nivel1.png", self.dirImagenes)
        objetosN2 = Servicios.cargarImagen("nivel2.png", self.dirImagenes)
        objetosN3 = Servicios.cargarImagen("nivel3.png", self.dirImagenes)
        
        self.gano = False
        self.nivel = 1
        
        self.personaje = self.tablero.personaje
        
        monstruoN11 = Monstruo.Monstruo(280, 0, 100, 1)
        monstruoN12 = Monstruo.Monstruo(680, 0, 100, 1)
        
        monstruoN21 = Monstruo.Monstruo(128 * 2, 0, 100, 2)
        monstruoN22 = Monstruo.Monstruo(256 * 2, 0, 100, 2)
        monstruoN23 = Monstruo.Monstruo(384 * 2, 0, 100, 2)
        monstruoN24 = Monstruo.Monstruo(512 * 2, 0, 100, 2)
        
        monstruoN31 = Monstruo.Monstruo(91 * 2, 0, 100, 3)
        monstruoN32 = Monstruo.Monstruo(183 * 2, 0, 100, 3)
        monstruoN33 = Monstruo.Monstruo(274 * 2, 0, 100, 3)
        monstruoN34 = Monstruo.Monstruo(366 * 2, 0, 100, 3)
        monstruoN35 = Monstruo.Monstruo(457 * 2, 0, 100, 3)
        monstruoN36 = Monstruo.Monstruo(548 * 2, 0, 100, 3)
        
        velocidad = 8
        
        anchoN1 = 80
        xN1 = -anchoN1
        yN1 = 252
        
        anchoN2 = 137
        xN2 = -anchoN1
        yN2 = 283
        
        anchoN3 = 185
        xN3 = -anchoN1
        yN3 = 301
        
        self.personaje.setAncho(anchoN1)
        self.personaje.setX(xN1)
        self.personaje.setY(yN1)
        
        
        
        self.audio.play()
        
        while self.gano == False:
            
            #-------Eventos-------
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()
                
                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                    
                    if self.cursor.colliderect(self.btnRegresar.rect):
                        self.tablero.sonido2.stop()
                        self.audio.stop()
                        self.gano = True
                        self.tablero.sonido.play(-1)
                        self.tablero.run()
                        
                    if self.cursor.colliderect(self.msjInicio.btn.rect):
                        self.msjInicio.visible = False
                        self.audio.stop()
                        self.tablero.sonido2.play(-1)
                        inicio = False
                        juego = True
                    
                    if self.cursor.colliderect(self.msjGanaste.btn.rect):
                        self.msjGanaste.visible = False
                        self.tablero.sonido2.stop()
                        self.gano = True
                        self.tablero.pasoCuentoAmor = True
                        # self.tablero.sonido.play(-1)
                        self.tablero.compartir.run("Amor", "Juego")
                        
                    if self.cursor.colliderect(self.msjPerdiste.btn.rect):
                        self.msjPerdiste.visible = False
                    
                    #===========================================================
                    # self.mouse.rect.center = pygame.mouse.get_pos()
                    #     
                    # if gano and pygame.sprite.collide_rect(self.botonTerminar, self.mouse):
                    #         self.tablero.sonido2.stop()
                    #         self.gano = True
                    #         self.tablero.pasoCuentoAmor = True
                    #         # self.tablero.sonido.play(-1)
                    #         self.tablero.compartir.run("Amor", "Juego")
                    #===========================================================
                            
                            # self.tablero.run()
                        
                    #===========================================================
                    # if inicio and pygame.sprite.collide_rect(self.botonContinuar, self.mouse):
                    #         inicio = False
                    #         juego = True
                    #===========================================================
                    
                    if self.cursor.colliderect(monstruoN11.rect):
                        monstruoN11.convertir()
                        # monstruoN11.rect.left, monstruoN11.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN12.rect):
                        monstruoN12.convertir()
                        # monstruoN12.rect.left, monstruoN12.rect.top = (0, 0)
                        
                    if self.cursor.colliderect(monstruoN21.rect):
                        monstruoN21.convertir()
                        # monstruoN21.rect.left, monstruoN21.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN22.rect):
                        monstruoN22.convertir()
                        # monstruoN22.rect.left, monstruoN22.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN23.rect):
                        monstruoN23.convertir()
                        # monstruoN23.rect.left, monstruoN23.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN24.rect):
                        monstruoN24.convertir()
                        # monstruoN24.rect.left, monstruoN24.rect.top = (0, 0)
                        
                    if self.cursor.colliderect(monstruoN31.rect):
                        monstruoN31.convertir()
                        # monstruoN31.rect.left, monstruoN31.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN32.rect):
                        monstruoN32.convertir()
                        # monstruoN32.rect.left, monstruoN32.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN33.rect):
                        monstruoN33.convertir()
                        # monstruoN33.rect.left, monstruoN33.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN34.rect):
                        monstruoN34.convertir()
                        # monstruoN34.rect.left, monstruoN34.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN35.rect):
                        monstruoN35.convertir()
                        # monstruoN35.rect.left, monstruoN35.rect.top = (0, 0)
                    if self.cursor.colliderect(monstruoN36.rect):
                        monstruoN36.convertir()
                        # monstruoN36.rect.left, monstruoN36.rect.top = (0, 0)

            self.clock.tick(60)
            
            self.cursor.update()
            
            self.screen.blit(self.fondo, (0, 0))
            
            self.msjInicio.update(self.screen, self.cursor)
            self.msjGanaste.update(self.screen, self.cursor)
            self.msjPerdiste.update(self.screen, self.cursor)
            self.btnRegresar.update(self.screen, self.cursor)
            
            if inicio:
                self.msjInicio.visible = True
                
                #===============================================================
                # self.screen.blit(self.transparente, (0, 0))
                # self.btnRegresar.update(self.screen, self.cursor)
                # 
                # self.screen.blit(self.instrucciones, (600 - 425, 100))
                # self.botonContinuar.rect.center = (600, 590)
                # self.screen.blit(self.botonContinuar.image, self.botonContinuar.rect)
                #===============================================================
            
            elif juego and self.msjPerdiste.visible == False:
            
                self.personaje.dibujarMov(self.screen, "der")
                
                if self.nivel == 1:

                    self.screen.blit(objetosN1, (0, 0))
                    
                    # aparece monstruo gradualmente
                    if(self.personaje.getX() > 20):
                        monstruoN11.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 400):
                        monstruoN12.dibujar(self.screen, self.personaje, velocidad)
                    
                    # GANO
                    if(self.personaje.getX() > 1200):
                        pygame.display.update()
                        pygame.time.delay(2000)
                        # incrementar el nivel
                        self.nivel = 2
                        self.personaje.setAncho(anchoN2)
                        self.personaje.setX(xN2)
                        self.personaje.setY(yN2)
                        monstruoN21 = Monstruo.Monstruo(128, 0, 85, 2)
                        monstruoN22 = Monstruo.Monstruo(256, 0, 85, 2)
                        monstruoN23 = Monstruo.Monstruo(384, 0, 85, 2)
                        monstruoN24 = Monstruo.Monstruo(512, 0, 85, 2)
                    
                    # PERDIO
                    if (self.personaje.rect.colliderect(monstruoN11.rect) and monstruoN11.vivo) or (self.personaje.rect.colliderect(monstruoN12.rect) and monstruoN12.vivo):
                        self.screen.blit(self.texto1, (550, 390))
                        # pygame.display.update()
                        # pygame.time.delay(4000)
                        self.msjPerdiste.visible = True
                        monstruoN11 = Monstruo.Monstruo(213, 0, 75, 1)
                        monstruoN12 = Monstruo.Monstruo(427, 0, 75, 1)
                        self.personaje.setX(xN1)
                        self.personaje.setY(yN1)
                    
                    self.personaje.setX(self.personaje.x + velocidad)
                    
                
                if self.nivel == 2:
                    
                    self.screen.blit(objetosN2, (0, 0))
                    
                    # aparece monstruo gradualmente
                    if(self.personaje.getX() > 20):
                        monstruoN21.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 120):
                        monstruoN22.dibujar(self.screen, self.personaje, velocidad)
                    
                    if(self.personaje.getX() > 220):
                        monstruoN23.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 400):
                        monstruoN24.dibujar(self.screen, self.personaje, velocidad)
                    
                    # GANO
                    if(self.personaje.getX() > 1200):
                        pygame.display.update()
                        pygame.time.delay(2000)
                        # incrementar el nivel
                        self.nivel = 3
                        self.personaje.setAncho(anchoN3)
                        self.personaje.setX(xN3)
                        self.personaje.setY(yN3)
                        monstruoN31 = Monstruo.Monstruo(91, 0, 85, 3)
                        monstruoN32 = Monstruo.Monstruo(183, 0, 85, 3)
                        monstruoN33 = Monstruo.Monstruo(274, 0, 85, 3)
                        monstruoN34 = Monstruo.Monstruo(366, 0, 85, 3)
                        monstruoN35 = Monstruo.Monstruo(457, 0, 85, 3)
                        monstruoN36 = Monstruo.Monstruo(548, 0, 85, 3)
                    
                    # PERDIO
                    if (self.personaje.rect.colliderect(monstruoN21.rect) and monstruoN21.vivo) or (self.personaje.rect.colliderect(monstruoN22.rect) and monstruoN22.vivo) or (self.personaje.rect.colliderect(monstruoN23.rect) and monstruoN23.vivo) or (self.personaje.rect.colliderect(monstruoN24.rect) and monstruoN24.vivo):
                        self.screen.blit(self.texto1, (550, 390))
                        #pygame.display.update()
                        #pygame.time.delay(4000)
                        self.msjPerdiste.visible = True
                        monstruoN21 = Monstruo.Monstruo(128, 0, 85, 2)
                        monstruoN22 = Monstruo.Monstruo(256, 0, 85, 2)
                        monstruoN23 = Monstruo.Monstruo(384, 0, 85, 2)
                        monstruoN24 = Monstruo.Monstruo(512, 0, 85, 2)
                        self.personaje.setX(xN2)
                        self.personaje.setY(yN2)
                    
                    self.personaje.setX(self.personaje.x + velocidad)
                    
                
                if self.nivel == 3:
                    
                    self.screen.blit(objetosN3, (0, 0))
                    
                    # aparece monstruo gradualmente
                    if(self.personaje.getX() > 20):
                        monstruoN31.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 120):
                        monstruoN32.dibujar(self.screen, self.personaje, velocidad)
                    
                    if(self.personaje.getX() > 220):
                        monstruoN33.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 400):
                        monstruoN34.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 500):
                        monstruoN35.dibujar(self.screen, self.personaje, velocidad)
                        
                    if(self.personaje.getX() > 600):
                        monstruoN36.dibujar(self.screen, self.personaje, velocidad)
                    
                    # GANO
                    if(self.personaje.getX() > 1200):
                        
                        pygame.display.update()
                        pygame.time.delay(2000)
                        gano = True
                        juego = False
                    
                    # PERDIO
                    if (self.personaje.rect.colliderect(monstruoN31.rect) and monstruoN31.vivo) or (self.personaje.rect.colliderect(monstruoN32.rect) and monstruoN32.vivo) or (self.personaje.rect.colliderect(monstruoN33.rect) and monstruoN33.vivo) or (self.personaje.rect.colliderect(monstruoN34.rect) and monstruoN34.vivo) or (self.personaje.rect.colliderect(monstruoN35.rect) and monstruoN35.vivo) or (self.personaje.rect.colliderect(monstruoN36.rect) and monstruoN36.vivo):
                        
                        self.screen.blit(self.texto1, (550, 390))
                        #pygame.display.update()
                        #pygame.time.delay(4000)
                        self.msjPerdiste.visible = True
                        monstruoN31 = Monstruo.Monstruo(91, 0, 85, 3)
                        monstruoN32 = Monstruo.Monstruo(183, 0, 85, 3)
                        monstruoN33 = Monstruo.Monstruo(274, 0, 85, 3)
                        monstruoN34 = Monstruo.Monstruo(366, 0, 85, 3)
                        monstruoN35 = Monstruo.Monstruo(457, 0, 85, 3)
                        monstruoN36 = Monstruo.Monstruo(548, 0, 85, 3)
                        self.personaje.setX(xN3)
                        self.personaje.setY(yN3)
                    
                    self.personaje.setX(self.personaje.x + velocidad)
            
            elif gano:
                
                if pasoSonidoExito == False:
                    self.tablero.sonidoExito.play()
                    pasoSonidoExito = True
                
                self.msjGanaste.visible = True   
                # self.screen.blit(self.transparente, (0, 0))
                # self.screen.blit(self.letrero, (380, 100))
                # self.screen.blit(self.botonTerminar.image, self.botonTerminar.rect)
                
            pygame.display.flip()
Ejemplo n.º 26
0
    def run(self):

        self.personaje.setAncho(100)
        self.personaje.setX(10)
        self.personaje.setY(385)

        anchoCanecas = 100
        xICanecas = 850
        deltaXCanecas = anchoCanecas + 10
        yICanecas = 700

        canecaAzul = Caneca.Caneca(xICanecas, yICanecas, anchoCanecas, 1)
        canecaBlanca = Caneca.Caneca(xICanecas + deltaXCanecas, yICanecas,
                                     anchoCanecas, 2)
        canecaGris = Caneca.Caneca(xICanecas + 2 * deltaXCanecas, yICanecas,
                                   anchoCanecas, 3)

        canecaAzul.setAncho2(anchoCanecas + 30)
        canecaBlanca.setAncho2(anchoCanecas + 30)
        canecaGris.setAncho2(anchoCanecas + 30)

        y2 = canecaAzul.alto2

        canecaAzul.setCoord2(330, (480 / 2 - y2 / 2))
        canecaBlanca.setCoord2(420, (480 / 2 - y2 / 2))
        canecaGris.setCoord2(510, (480 / 2 - y2 / 2))

        xAzul = canecaAzul.x2 + 260
        xBlanca = canecaBlanca.x2 + 300
        xGris = canecaGris.x2 + 340

        y = canecaGris.y2 + 200

        canecaAzul.setCoord2(xAzul, y)
        canecaGris.setCoord2(xGris, y)
        canecaBlanca.setCoord2(xBlanca, y)

        canecaAzul.setAnchoInfo(anchoCanecas + 110)
        canecaBlanca.setAnchoInfo(anchoCanecas + 110)
        canecaGris.setAnchoInfo(anchoCanecas + 110)

        yInfo = canecaAzul.altoInfo

        canecaAzul.setCoordInfo(300, (825 / 2 - yInfo / 2 - 25))
        canecaBlanca.setCoordInfo(550, (825 / 2 - yInfo / 2 - 25))
        canecaGris.setCoordInfo(800, (825 / 2 - yInfo / 2 - 25))

        obj1 = ObjetoCaneca.ObjetoCaneca(255, 600, 60, random.randint(1, 3),
                                         random.randint(1, 4))
        obj2 = ObjetoCaneca.ObjetoCaneca(100, 720, 60, random.randint(1, 3),
                                         random.randint(1, 4))
        obj3 = ObjetoCaneca.ObjetoCaneca(600, 580, 60, random.randint(1, 3),
                                         random.randint(1, 4))
        obj4 = ObjetoCaneca.ObjetoCaneca(1065, 570, 60, random.randint(1, 3),
                                         random.randint(1, 4))
        obj5 = ObjetoCaneca.ObjetoCaneca(630, 685, 60, random.randint(1, 3),
                                         random.randint(1, 4))

        listaObjetos = []
        objActual = 0

        puedeMoverse = True

        encontro1 = False
        encontro2 = False
        encontro3 = False
        encontro4 = False
        encontro5 = False

        guardo1 = False
        guardo2 = False
        guardo3 = False
        guardo4 = False
        guardo5 = False

        sonido2Sonando = False

        guardoTodos = False

        vioMensaje = False
        popUpFaltanVisible = False
        popUpTerminoVisible = False
        popUpAyudaVisible = False
        botandoBasura = False

        pasoSonidoExito = False

        fuenteTitulo = pygame.font.SysFont("helvetica", 28, True)
        fuenteTexto = pygame.font.SysFont("helvetica", 20)
        fuenteTextoN = pygame.font.SysFont("helvetica", 20, True)

        imgEncontro = Servicios.cargarImagen("letreroEncontro.png",
                                             self.dirImagenes)
        imgFalta = Servicios.cargarImagen("letreroFalta.png", self.dirImagenes)
        imgTermino = Servicios.cargarImagen("letreroTermino.png",
                                            self.dirImagenes)
        imgBotando = Servicios.cargarImagen("letreroBotandoBasura.png",
                                            self.dirImagenes)

        xImgEncontro = (1200 / 2) - (imgEncontro.get_width() / 2)
        xImgFalta = (1200 / 2) - (imgFalta.get_width() / 2)
        xImgTermino = (1200 / 2) - (imgTermino.get_width() / 2)
        xImgBotando = (1200 / 2) - (imgBotando.get_width() / 2)

        yImgEncontro = (825 / 2) - (imgEncontro.get_height() / 2)
        yImgFalta = (825 / 2) - (imgFalta.get_height() / 2)
        yImgTermino = (825 / 2) - (imgTermino.get_height() / 2)
        yImgBotando = (825 / 2) - (imgBotando.get_height() / 2)

        imgBtnRecoger = Servicios.cargarImagen("boton_continuar.png",
                                               "imagenes")
        imgBtnRecogerSelec = Servicios.cargarImagen(
            "boton_continuar_selec.png", "imagenes")

        btnRecoger = Boton.Boton(imgBtnRecoger, imgBtnRecogerSelec,
                                 (1200 / 2) - (imgBtnRecoger.get_width() / 2),
                                 600)

        imgBtnAceptar = Servicios.cargarImagen("boton_continuar.png",
                                               "imagenes")
        imgBtnAceptarSelec = Servicios.cargarImagen(
            "boton_continuar_selec.png", "imagenes")

        btnAceptar = Boton.Boton(imgBtnAceptar, imgBtnAceptarSelec,
                                 (1200 / 2) - (imgBtnAceptar.get_width() / 2),
                                 400)

        imgBtnAceptar2 = Servicios.cargarImagen("boton_continuar.png",
                                                "imagenes")
        imgBtnAceptar2Selec = Servicios.cargarImagen(
            "boton_continuar_selec.png", "imagenes")

        btnAceptar2 = Boton.Boton(imgBtnAceptar2, imgBtnAceptar2Selec,
                                  (1200 / 2) - (imgBtnAceptar.get_width() / 2),
                                  600)

        imgBtnAyuda = Servicios.cargarImagen("botonAyuda.png",
                                             self.dirImagenes)
        imgBtnAyudaSelec = Servicios.cargarImagen("botonAyuda.png",
                                                  self.dirImagenes)

        btnAyuda = Boton.Boton(imgBtnAyuda, imgBtnAyudaSelec,
                               (1200 / 2) - (imgBtnAceptar.get_width() / 2),
                               600)

        pygame.key.set_repeat(1, 25)  # Activa repeticion de teclas

        inicio = True
        juego = False
        gano = False

        moviendose = False
        mov = ""

        self.gano = False

        self.audio.play()

        while self.gano == False:

            self.clock.tick(60)

            self.cursor.update()

            self.screen.blit(self.fondo, (0, 0))

            self.msjInicio.update(self.screen, self.cursor)
            self.msjGanaste.update(self.screen, self.cursor)

            if inicio:
                self.msjInicio.visible = True
                self.btnRegresar.update(self.screen, self.cursor)

            elif juego:

                self.btnRegresar.update(self.screen, self.cursor)

                if moviendose:
                    self.personaje.dibujarMov(self.screen, mov)
                else:
                    self.personaje.dibujar(self.screen)

                if encontro1 == False and guardo1 == False:
                    self.screen.blit(obj1.imagen, (obj1.x, obj1.y))
                if encontro2 == False and guardo2 == False:
                    self.screen.blit(obj2.imagen, (obj2.x, obj2.y))
                if encontro3 == False and guardo3 == False:
                    self.screen.blit(obj3.imagen, (obj3.x, obj3.y))
                if encontro4 == False and guardo4 == False:
                    self.screen.blit(obj4.imagen, (obj4.x, obj4.y))
                if encontro5 == False and guardo5 == False:
                    self.screen.blit(obj5.imagen, (obj5.x, obj5.y))

                self.screen.blit(canecaGris.imagen,
                                 (canecaGris.x, canecaGris.y))
                self.screen.blit(canecaBlanca.imagen,
                                 (canecaBlanca.x, canecaBlanca.y))
                self.screen.blit(canecaAzul.imagen,
                                 (canecaAzul.x, canecaAzul.y))

                if encontro1 == True:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgEncontro, (xImgEncontro, yImgEncontro))
                    obj1.setAncho(150)
                    self.screen.blit(obj1.imagen,
                                     ((1200 / 2) - (obj1.ancho / 2), 350))
                    # texto = fuenteTitulo.render("Encontraste un objeto", 1, (0, 0, 0))
                    nombre = fuenteTexto.render(obj1.nombre, 1, (0, 0, 0))
                    # self.screen.blit(texto, (210, 60))
                    self.screen.blit(nombre,
                                     ((1200 / 2) - (obj1.ancho / 2), 315))
                    btnRecoger.update(self.screen, self.cursor)

                if encontro2 == True:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgEncontro, (xImgEncontro, yImgEncontro))
                    obj2.setAncho(150)
                    self.screen.blit(obj2.imagen,
                                     ((1200 / 2) - (obj2.ancho / 2), 350))
                    # texto = fuenteTitulo.render("Encontraste un objeto", 1, (0, 0, 0))
                    nombre = fuenteTexto.render(obj2.nombre, 1, (0, 0, 0))
                    # self.screen.blit(texto, (200, 60))
                    self.screen.blit(nombre,
                                     ((1200 / 2) - (obj2.ancho / 2), 315))
                    btnRecoger.update(self.screen, self.cursor)

                if encontro3 == True:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgEncontro, (xImgEncontro, yImgEncontro))
                    obj3.setAncho(150)
                    self.screen.blit(obj3.imagen,
                                     ((1200 / 2) - (obj3.ancho / 2), 350))
                    # texto = fuenteTitulo.render("Encontraste un objeto", 1, (0, 0, 0))
                    nombre = fuenteTexto.render(obj3.nombre, 1, (0, 0, 0))
                    # self.screen.blit(texto, (200, 60))
                    self.screen.blit(nombre,
                                     ((1200 / 2) - (obj3.ancho / 2), 315))
                    btnRecoger.update(self.screen, self.cursor)

                if encontro4 == True:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgEncontro, (xImgEncontro, yImgEncontro))
                    obj4.setAncho(150)
                    self.screen.blit(obj4.imagen,
                                     ((1200 / 2) - (obj4.ancho / 2), 350))
                    # texto = fuenteTitulo.render("Encontraste un objeto", 1, (0, 0, 0))
                    nombre = fuenteTexto.render(obj4.nombre, 1, (0, 0, 0))
                    # self.screen.blit(texto, (200, 60))
                    self.screen.blit(nombre,
                                     ((1200 / 2) - (obj4.ancho / 2), 315))
                    btnRecoger.update(self.screen, self.cursor)

                if encontro5 == True:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgEncontro, (xImgEncontro, yImgEncontro))
                    obj5.setAncho(150)
                    self.screen.blit(obj5.imagen,
                                     ((1200 / 2) - (obj5.ancho / 2), 350))
                    # texto = fuenteTitulo.render("Encontraste un objeto", 1, (0, 0, 0))
                    nombre = fuenteTexto.render(obj5.nombre, 1, (0, 0, 0))
                    # self.screen.blit(texto, (200, 60))
                    self.screen.blit(nombre,
                                     ((1200 / 2) - (obj5.ancho / 2), 315))
                    btnRecoger.update(self.screen, self.cursor)

                if guardoTodos == True and vioMensaje == False:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgTermino, (xImgTermino, yImgTermino))
                    # texto = fuenteTitulo.render("Has recogido todos los objetos ", 1, (0, 0, 0))
                    # texto2 = fuenteTexto.render("Ahora debes ponerlos en su lugar. Dirigete a las canecas. ", 1, (0, 0, 0))
                    # self.screen.blit(texto, (150, 130))
                    # self.screen.blit(texto2, (120, 200))
                    btnAceptar.update(self.screen, self.cursor)

                if guardo1 == True and guardo2 == True and guardo3 == True and guardo4 == True and guardo5 == True:
                    guardoTodos = True

                if self.personaje.rect.colliderect(obj1.rect):
                    print "colisiono con objeto 1", obj1.nombre
                    obj1.setCoord(0, 0)
                    encontro1 = True

                if self.personaje.rect.colliderect(obj2.rect):
                    print "colisiono con objeto 2", obj2.nombre
                    obj2.setCoord(0, 0)
                    encontro2 = True

                if self.personaje.rect.colliderect(obj3.rect):
                    print "colisiono con objeto 3", obj3.nombre
                    obj3.setCoord(0, 0)
                    encontro3 = True

                if self.personaje.rect.colliderect(obj4.rect):
                    print "colisiono con objeto 4", obj4.nombre
                    obj4.setCoord(0, 0)
                    encontro4 = True

                if self.personaje.rect.colliderect(obj5.rect):
                    print "colisiono con objeto 5", obj5.nombre
                    obj5.setCoord(0, 0)
                    encontro5 = True

                if self.personaje.rect.colliderect(
                        canecaAzul.rect) or self.personaje.rect.colliderect(
                            canecaBlanca.rect
                        ) or self.personaje.rect.colliderect(canecaGris.rect):
                    # print "colisiono con canecas"
                    if guardoTodos == False:
                        popUpFaltanVisible = True
                    else:
                        popUpTerminoVisible = True

                if popUpFaltanVisible:
                    puedeMoverse = False
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgFalta, (xImgFalta, yImgFalta))
                    # texto = fuenteTitulo.render("Faltan objetos por recoger", 1, (0, 0, 0))
                    # texto2 = fuenteTexto.render("Cuando recojas todos los objetos podras depositarlos en las canecas.", 1, (0, 0, 0))
                    # self.screen.blit(texto, (180, 130))
                    # self.screen.blit(texto2, (60, 200))
                    btnAceptar.update(self.screen, self.cursor)

                if popUpTerminoVisible:
                    puedeMoverse = False
                    botandoBasura = True
                    self.screen.blit(self.transparente, (0, 0))
                    self.screen.blit(imgBotando, (xImgBotando, yImgBotando))

                    if objActual < len(listaObjetos):

                        self.objeto = listaObjetos[objActual]

                        # texto = fuenteTitulo.render("Poniendo la basura en su lugar", 1, (0, 0, 0))
                        textoObjeto = fuenteTextoN.render(
                            "Objeto: %s" % (self.objeto.nombre), 1, (0, 0, 0))
                        textoCanecas = fuenteTextoN.render(
                            "Canecas", 1, (0, 0, 0))
                        # textoInfo = fuenteTexto.render("Haz click en la caneca adecuada para depositar el objeto.", 1, (0, 0, 0))
                        # self.screen.blit(texto, (160, 60))
                        self.screen.blit(textoObjeto, (340, 130 + 200))
                        self.screen.blit(textoCanecas,
                                         (canecaAzul.x2, 130 + 200))
                        # self.screen.blit(textoInfo, (120, 100))
                        self.screen.blit(canecaGris.imagen2,
                                         (canecaGris.x2, canecaGris.y2))
                        self.screen.blit(canecaBlanca.imagen2,
                                         (canecaBlanca.x2, canecaBlanca.y2))
                        self.screen.blit(canecaAzul.imagen2,
                                         (canecaAzul.x2, canecaAzul.y2))

                        self.screen.blit(self.objeto.imagen, (340, 160 + 200))

                        btnAyuda.update(self.screen, self.cursor)

    # GANOOOOOOOOO
                    else:
                        # self.gano = True
                        # self.cita.run()
                        gano = True
                        juego = False

                if popUpAyudaVisible:
                    botandoBasura = False
                    self.screen.blit(imgBotando, (xImgBotando, yImgBotando))
                    self.screen.blit(canecaGris.imagenInfo,
                                     (canecaGris.xInfo, canecaGris.yInfo))
                    self.screen.blit(canecaBlanca.imagenInfo,
                                     (canecaBlanca.xInfo, canecaBlanca.yInfo))
                    self.screen.blit(canecaAzul.imagenInfo,
                                     (canecaAzul.xInfo, canecaAzul.yInfo))
                    btnAceptar2.update(self.screen, self.cursor)

            elif gano:
                if pasoSonidoExito == False:
                    self.tablero.sonidoExito.play()
                    pasoSonidoExito = True

                self.msjGanaste.visible = True

                #===============================================================
                # self.screen.blit(self.transparente, (0, 0))
                # self.screen.blit(self.letrero, (380, 100))
                # self.screen.blit(self.botonTerminar.image, self.botonTerminar.rect)
                #===============================================================

            pygame.display.flip()

            #-------Eventos-------

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()

                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:

                    if self.cursor.colliderect(self.btnRegresar.rect):
                        self.tablero.sonido2.stop()
                        self.audio.stop()
                        self.gano = True
                        self.tablero.sonido.play(-1)
                        self.tablero.run()

                    if self.cursor.colliderect(self.msjInicio.btn.rect):
                        self.msjInicio.visible = False
                        self.audio.stop()
                        if sonido2Sonando == False:
                            sonido2Sonando = True
                            self.tablero.sonido2.play(-1)
                        inicio = False
                        juego = True

                    if self.cursor.colliderect(self.msjGanaste.btn.rect):
                        self.msjGanaste.visible = False
                        pygame.key.set_repeat(1000, 25)
                        self.tablero.sonido2.stop()
                        self.gano = True
                        # self.cita.run()
                        self.tablero.pasoCuentoRectitud = True
                        self.tablero.compartir.run("Rectitud", "Juego")

                    if botandoBasura:
                        if self.cursor.colliderect(canecaAzul.rect2):
                            if self.objeto.caneca == 1:
                                print "bien"
                                objActual += 1
                            else:
                                print "mal"

                        if self.cursor.colliderect(canecaBlanca.rect2):
                            if self.objeto.caneca == 2:
                                print "bien"
                                objActual += 1
                            else:
                                print "mal"

                        if self.cursor.colliderect(canecaGris.rect2):
                            if self.objeto.caneca == 3:
                                print "bien"
                                objActual += 1
                            else:
                                print "mal"

                    if self.cursor.colliderect(btnRecoger.rect):
                        if encontro1 == True:
                            guardo1 = True
                            encontro1 = False
                            listaObjetos.append(obj1)
                        if encontro2 == True:
                            guardo2 = True
                            encontro2 = False
                            listaObjetos.append(obj2)
                        if encontro3 == True:
                            guardo3 = True
                            encontro3 = False
                            listaObjetos.append(obj3)
                        if encontro4 == True:
                            guardo4 = True
                            encontro4 = False
                            listaObjetos.append(obj4)
                        if encontro5 == True:
                            guardo5 = True
                            encontro5 = False
                            listaObjetos.append(obj5)
                        puedeMoverse = True

                    if self.cursor.colliderect(btnAceptar.rect):
                        if guardoTodos == True:
                            vioMensaje = True
                            puedeMoverse = True
                        if popUpFaltanVisible:
                            popUpFaltanVisible = False
                            puedeMoverse = True
                            self.personaje.setX(self.personaje.x - 5)
                            self.personaje.setY(self.personaje.y - 5)

                    if self.cursor.colliderect(btnAyuda.rect):
                        if popUpTerminoVisible and popUpAyudaVisible == False:
                            popUpAyudaVisible = True
                        else:
                            popUpAyudaVisible = False

                elif event.type == pygame.KEYDOWN:
                    if puedeMoverse:
                        if event.key == K_UP:
                            if self.personaje.y >= 350:
                                moviendose = True
                                mov = "arriba"
                                self.personaje.setY(self.personaje.y - 5)
                        elif event.key == K_DOWN:
                            if self.personaje.y <= 650:
                                moviendose = True
                                mov = "abajo"
                                self.personaje.setY(self.personaje.y + 5)
                        elif event.key == K_RIGHT:
                            if self.personaje.x <= 1100:
                                moviendose = True
                                mov = "der"
                                self.personaje.setX(self.personaje.x + 5)
                        elif event.key == K_LEFT:
                            if self.personaje.x >= 0:
                                moviendose = True
                                mov = "izq"
                                self.personaje.setX(self.personaje.x - 5)

                elif event.type == pygame.KEYUP:
                    moviendose = False
Ejemplo n.º 27
0
    def run(self):

        resource.set_images_path(os.path.join("imagenes"))

        if self.mostrarCreditos:
            creditos = resource.get_image("Creditos.jpg", False)
            self.mostrarCreditos = False
            self.screen.blit(creditos, (0, 0))
            pygame.display.update()

        fondo = resource.get_image("Fondo.jpg", False)
        logo = Servicios.cargarImagen("logo.png", self.dirImagenes)

        if self.personaje is None:
            imagenPersonaje = Servicios.cargarImagen(
                "Frente1.png", os.path.join("imagenes", "verdad"))
            self.personaje = Personaje.Personaje(5, 40, 175, "M",
                                                 imagenPersonaje)
            print "entro personaje"

        if self.tablero is None:
            self.tablero = tableroCentral.tableroCentral(
                self, self.cursor, self.screen, self.clock, self.ancho,
                self.alto)
            print "entro tablero"

        if self.tutorial is None:
            self.tutorial = VentanaTutorial.VentanaTutorial(
                self, self.cursor, self.screen, self.clock, self.ancho,
                self.alto)
            print "entro tutorial"

        if self.ventPersonaje is None:
            self.ventPersonaje = VentanaPersonaje.VentanaPersonaje(
                self, self.cursor, self.screen, self.clock, self.ancho,
                self.alto)
            print "entro ventPersonaje"
            self.musicaMenu.play(
                -1)  #reproducir la musica solo la primera vez que se corre

        #=======================================================================
        # resource.set_images_path(os.path.join("imagenes"))
        # fondo = resource.get_image("Fondo.jpg", False)
        # #fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"), False)
        # logo = Servicios.cargarImagen("logo.png", self.dirImagenes)
        #=======================================================================

        salir = False

        while salir == False:
            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()

                if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                    if self.cursor.colliderect(self.btnJugar.rect):
                        salir = True
                        self.ventPersonaje.run()

                    #if self.cursor.colliderect(self.btnAprender.rect):
                    #salir = True
                    #self.tutorial.run()

                    if self.cursor.colliderect(self.btnSalir.rect):
                        salir = True
                        pygame.quit()
                        sys.exit()

            self.clock.tick(60)

            self.cursor.update()

            self.screen.blit(fondo, (0, 0))
            self.screen.blit(logo, (0, 0))

            self.btnJugar.update(self.screen, self.cursor)
            #self.btnAprender.update(self.screen, self.cursor)
            self.btnSalir.update(self.screen, self.cursor)

            pygame.display.update()
Ejemplo n.º 28
0
    def __init__(self, cursor, screen, clock, tipo, padre):
        # def __init__(self, cursor, screen, clock):
        self.dirImagenes = os.path.join("imagenes", "karaoke")
        self.screen = screen
        self.clock = clock
        self.cursor = cursor
        self.tipo = tipo
        self.tablero = padre
        self.fondo = Servicios.cargarImagen("Fondo.jpg", "imagenes")
        # self.instrucciones = Servicios.cargarImagen("letrero_karaoke.png", self.dirImagenes)
        # self.transparente = pygame.image.load(os.path.join("imagenes", "verdad", "transparente.png")).convert_alpha()
        self.botonAceptar = Boton.BotonContinuar()
        self.mouse = Cursor.Mouse()

        self.msjInicio = MensajeEmergente.MensajeInicial(40, "Canto")

        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png",
                                                "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen(
            "boton_regresar_selec.png", "imagenes")

        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (1200 - 214 - 10), 10)

        self.initFont()

        # tipo
        if self.tipo == 1:

            # self.compartir = compartirAmor.CompartirAmor(self.screen, self.clock, self.tablero)

            # self.letra = Servicios.cargarImagen("letra_paz.png", self.dirImagenes)
            self.linea1 = self.font.render(
                u"   Levanta la mano y grita fuerte  ", False, (0, 0, 0))
            self.linea2 = self.font.render(
                u"              amor, amor, amor         ", False, (0, 0, 0))
            self.linea3 = self.font.render(
                u"        Libera al mundo de su rabia    ", False, (0, 0, 0))
            self.linea4 = self.font.render(
                u"               y su mal humor          ", False, (0, 0, 0))
            self.linea5 = self.font.render(
                u"Mira hacia adentro en tu corazón...", False, (0, 0, 0))
            self.linea6 = self.linea5
            self.linea7 = self.font.render(
                u"         Haz silencio y escucha      ", False, (0, 0, 0))
            self.linea8 = self.font.render(
                u"         la razón... amor, amor      ", False, (0, 0, 0))
            self.linea9 = self.linea1
            self.linea10 = self.linea2
            self.linea11 = self.font.render(
                u"     Búscate dentro y encuentra    ", False, (0, 0, 0))
            self.linea12 = self.font.render(
                u"        el valor del amor, amor      ", False, (0, 0, 0))
            self.linea13 = self.font.render(
                u" Mira a los ojos y levanta tu voz...", False, (0, 0, 0))
            self.linea14 = self.linea2
            self.linea15 = self.font.render(
                u"         Transforma el planeta      ", False, (0, 0, 0))
            self.linea16 = self.font.render(
                u"             protege el árbol         ", False, (0, 0, 0))
            self.linea17 = self.font.render(
                u"        Canta, juega e imagina...    ", False, (0, 0, 0))
            self.linea18 = self.font.render(
                u"         Haz silencio se anuncia     ", False, (0, 0, 0))
            self.linea19 = self.linea12
            self.linea20 = self.linea1
            self.linea21 = self.linea2
            self.linea22 = self.font.render(
                "Mira a los ojos y levanta tu voz...", False, (0, 0, 0))
            self.linea23 = self.linea2
            self.linea24 = self.font.render(
                u"    Busca en los ojos y descubre   ", False, (0, 0, 0))
            self.linea25 = self.linea12

            self.cancion = Servicios.cargarSonido("amor.ogg",
                                                  os.path.join("audios"))

        elif self.tipo == 2:

            # self.compartir = compartirRectitud.CompartirRectitud(self.screen, self.clock, self.tablero)

            self.linea1 = self.font.render(
                u"         Siempre en la ruta hay dos caminos    ", False,
                (0, 0, 0))
            self.linea2 = self.font.render(
                u"                   y yo elijo ¿cuál seguire?    ", False,
                (0, 0, 0))
            self.linea3 = self.font.render(
                u"            Si grito fuerte todos se asustan   ", False,
                (0, 0, 0))
            self.linea4 = self.font.render(
                u"                mejor dialogo, ¡yo lo haré!    ", False,
                (0, 0, 0))
            self.linea5 = self.font.render(
                u"       Miro a lo lejos un bosque sucio y pienso", False,
                (0, 0, 0))
            self.linea6 = self.font.render(
                u"                        ¿qué debo hacer?       ", False,
                (0, 0, 0))
            self.linea7 = self.font.render(
                u"             Una voz dentro responde fuerte    ", False,
                (0, 0, 0))
            self.linea8 = self.font.render(
                u"                           ¡lo limpiaré!        ", False,
                (0, 0, 0))
            self.linea9 = self.font.render(
                u"   Y en las tardes ya en mi casa algo pregunta  ", False,
                (0, 0, 0))
            self.linea10 = self.linea6
            self.linea11 = self.font.render(
                u" pienso en los juegos en mis amigos ir a la calle", False,
                (0, 0, 0))
            self.linea12 = self.font.render(
                u"               pero alegre respondo pronto       ", False,
                (0, 0, 0))
            self.linea13 = self.font.render(
                u"                  ¡Primero haré mi deber!         ", False,
                (0, 0, 0))
            self.linea14 = self.linea13
            self.linea15 = self.linea13

            self.cancion = Servicios.cargarSonido("rectitud.ogg",
                                                  os.path.join("audios"))

        elif self.tipo == 3:

            # self.compartir = compartirPaz.CompartirPaz(self.screen, self.clock, self.tablero)

            self.linea1 = self.font.render(
                u"       Árbol, perro, ave, río, aire soy ", False, (0, 0, 0))
            self.linea2 = self.font.render(
                u"            Comprendo lo que digo       ", False, (0, 0, 0))
            self.linea3 = self.font.render(
                u"               por eso hoy te cuido...  ", False, (0, 0, 0))
            self.linea4 = self.font.render(
                u"Mestizo, negro, blanco, indio, zambo soy", False, (0, 0, 0))
            self.linea5 = self.font.render(
                u"               Te quiero y te respeto   ", False, (0, 0, 0))
            self.linea6 = self.font.render(
                u"               contigo siempre voy...   ", False, (0, 0, 0))
            self.linea7 = self.font.render(
                u"            En el mar, en la montaña   ", False, (0, 0, 0))
            self.linea8 = self.font.render(
                u"              en la selva o la ciudad    ", False, (0, 0, 0))
            self.linea9 = self.font.render(
                u"           como hermanos andaremos     ", False, (0, 0, 0))
            self.linea10 = self.font.render(
                u"                  para vivir en paz     ", False, (0, 0, 0))
            self.linea11 = self.font.render(
                u"              En un día de disgustos     ", False, (0, 0, 0))
            self.linea12 = self.font.render(
                u"                de peleas sin razón      ", False, (0, 0, 0))
            self.linea13 = self.font.render(
                u"                miro fijo a tus ojos      ", False,
                (0, 0, 0))
            self.linea14 = self.linea13
            self.linea15 = self.font.render(
                u"               para ver el corazón       ", False, (0, 0, 0))
            self.linea16 = self.linea7
            self.linea17 = self.linea8
            self.linea18 = self.linea9
            self.linea19 = self.linea10
            self.linea20 = self.linea7
            self.linea21 = self.linea8
            self.linea22 = self.linea9
            self.linea23 = self.linea10

            self.cancion = Servicios.cargarSonido("paz.ogg",
                                                  os.path.join("audios"))

        elif self.tipo == 4:

            # self.compartir = compartirVerdad.CompartirVerdad(self.screen, self.clock, self.tablero)

            self.linea1 = self.font.render(
                u"                Verdad, verdad, verdad     ", False,
                (0, 0, 0))
            self.linea2 = self.font.render(
                u"       no más mentiras, por favor no más   ", False,
                (0, 0, 0))
            self.linea3 = self.font.render(
                u"                    por favor no más       ", False,
                (0, 0, 0))
            self.linea4 = self.font.render(
                u" que en la guerra no se pierdan mis sueños ", False,
                (0, 0, 0))
            self.linea5 = self.font.render(
                u"               quiero crecer en libertad   ", False,
                (0, 0, 0))
            self.linea6 = self.font.render(
                u"        Quiero siempre el calor del sol    ", False,
                (0, 0, 0))
            self.linea7 = self.font.render(
                u"     que me acompañe un gran resplandor    ", False,
                (0, 0, 0))
            self.linea8 = self.font.render(
                u"la esencia está adentro y entiendo el valor", False,
                (0, 0, 0))
            self.linea9 = self.font.render(
                u"         de todo lo que dice tu corazón    ", False,
                (0, 0, 0))
            self.linea10 = self.font.render(
                u"              Un espejo te reflejará       ", False,
                (0, 0, 0))
            self.linea11 = self.font.render(
                "        pero no te pierdas en la vanidad    ", False,
                (0, 0, 0))
            self.linea12 = self.font.render(
                "       si me hablas siempre con la verdad   ", False,
                (0, 0, 0))
            self.linea13 = self.font.render(
                u"        mi corazón explota de felicidad    ", False,
                (0, 0, 0))
            self.linea14 = self.linea1
            self.linea15 = self.linea2
            self.linea16 = self.linea3
            self.linea17 = self.linea4
            self.linea18 = self.linea5
            self.linea19 = self.linea1
            self.linea20 = self.linea2
            self.linea21 = self.linea3
            self.linea22 = self.linea4
            self.linea23 = self.linea5

            self.cancion = Servicios.cargarSonido("verdad.ogg",
                                                  os.path.join("audios"))

        elif self.tipo == 5:

            # self.compartir = compartirNoViolencia.CompartirNoViolencia(self.screen, self.clock, self.tablero)

            self.linea1 = self.font.render(
                u"    Cierra las manos hacia el frente", False, (0, 0, 0))
            self.linea2 = self.font.render(
                u"        alista un dedo, el de señalar", False, (0, 0, 0))
            self.linea3 = self.font.render(
                u"      muévelo a un lado y hacia al otro", False, (0, 0, 0))
            self.linea4 = self.font.render(
                u"         y a los violentos tú les dirás", False, (0, 0, 0))
            self.linea5 = self.font.render(
                u"      Ya no más gritos, ya no más armas", False, (0, 0, 0))
            self.linea6 = self.font.render(
                u"               no quiero más guerra    ", False, (0, 0, 0))
            self.linea7 = self.font.render(
                u"                     ¡no violencia!    ", False, (0, 0, 0))
            self.linea8 = self.linea5
            self.linea9 = self.linea6
            self.linea10 = self.linea7
            self.linea11 = self.font.render(
                u"         Corre rápido hacia tu familia ", False, (0, 0, 0))
            self.linea12 = self.font.render(
                u"         Pero los brazos debes levantar ", False, (0, 0, 0))
            self.linea13 = self.font.render(
                u"           y cuando los tengas cerca    ", False, (0, 0, 0))
            self.linea14 = self.font.render(
                u"           Con un abrazo tú les dirás   ", False, (0, 0, 0))
            self.linea15 = self.font.render(
                u"      Ya no más gritos, no más peleas", False, (0, 0, 0))
            self.linea16 = self.font.render(
                u"                   No más ofensas        ", False, (0, 0, 0))
            self.linea17 = self.linea7
            self.linea18 = self.linea15
            self.linea19 = self.linea16
            self.linea20 = self.linea7

            self.cancion = Servicios.cargarSonido("noViolencia.ogg",
                                                  os.path.join("audios"))

        # self.cancion = Servicios.cargarSonido("cancion_karaoke.ogg", os.path.join("audios"))

        imgBotonContinuar = pygame.image.load(
            os.path.join("imagenes", "boton_continuar.png")).convert_alpha()

        self.botonContinuar = Boton.Boton(imgBotonContinuar, imgBotonContinuar,
                                          10, 100)

        imgBotonReproducir = Servicios.cargarImagen("boton_play.png",
                                                    self.dirImagenes)
        imgBotonReproducirSelec = Servicios.cargarImagen(
            "boton_play_selec.png", self.dirImagenes)

        self.botonReproducir = Boton.Boton(imgBotonReproducir,
                                           imgBotonReproducirSelec, 10, 50)

        imgBotonPausar = Servicios.cargarImagen("boton_pause.png",
                                                self.dirImagenes)
        imgBotonPausarSelec = Servicios.cargarImagen("boton_pause_selec.png",
                                                     self.dirImagenes)
        # pausar, reanudar
        self.botonPausar = Boton.Boton(imgBotonPausar, imgBotonPausarSelec, 70,
                                       50)
        # detener, reproducir
        imgBotonDetener = Servicios.cargarImagen("boton_stop.png",
                                                 self.dirImagenes)
        imgBotonDetenerSelec = Servicios.cargarImagen("boton_stop_selec.png",
                                                      self.dirImagenes)

        self.botonDetener = Boton.Boton(imgBotonDetener, imgBotonDetenerSelec,
                                        130, 50)
Ejemplo n.º 29
0
    def __init__(self, x, y, anch, caneca, obj):
        self.x = x
        self.y = y
        self.ancho = anch
        self.caneca = caneca
        self.objeto = obj
        self.nombre = ""

        if self.caneca == 1:
            self.dirImagenes = os.path.join("imagenes", "rectitud", "objetos",
                                            "CanecaAzul")
            if self.objeto == 1:
                self.nombre = "Balde plastico"
            if self.objeto == 2:
                self.nombre = "Bolsa plastica"
            if self.objeto == 3:
                self.ancho = self.ancho / 2
                self.nombre = "Botella plastica"
            if self.objeto == 4:
                self.nombre = "Vaso plastico"
        if self.caneca == 2:
            self.dirImagenes = os.path.join("imagenes", "rectitud", "objetos",
                                            "CanecaBlanca")

            if self.objeto == 1:
                self.ancho = self.ancho / 2
                self.nombre = "Botella de vidrio"
            if self.objeto == 2:
                self.nombre = "Lata de sardinas"
            if self.objeto == 3:
                self.ancho = self.ancho / 2
                self.nombre = "Vaso de vidrio"
            if self.objeto == 4:
                self.nombre = "Vidrio roto"
        if self.caneca == 3:
            self.dirImagenes = os.path.join("imagenes", "rectitud", "objetos",
                                            "CanecaGris")
            if self.objeto == 1:
                self.nombre = "Caja de carton"
            if self.objeto == 2:
                self.nombre = "Papel"
            if self.objeto == 3:
                self.nombre = "Periodico"
            if self.objeto == 4:
                self.nombre = "Rollo de carton"

        if self.objeto == 1:
            self.imagenOriginal = Servicios.cargarImagen(
                "objeto1.png", self.dirImagenes)

        if self.objeto == 2:
            self.imagenOriginal = Servicios.cargarImagen(
                "objeto2.png", self.dirImagenes)

        if self.objeto == 3:
            self.imagenOriginal = Servicios.cargarImagen(
                "objeto3.png", self.dirImagenes)

        if self.objeto == 4:
            self.imagenOriginal = Servicios.cargarImagen(
                "objeto4.png", self.dirImagenes)

        self.imagen = self.imagenOriginal

        self.alto = self.ancho * self.imagenOriginal.get_height(
        ) / self.imagenOriginal.get_width()

        self.imagen = pygame.transform.smoothscale(self.imagenOriginal,
                                                   (self.ancho, self.alto))

        self.rect = self.imagen.get_rect()
        self.rect.left, self.rect.top = (self.x, self.y)
Ejemplo n.º 30
0
    def __init__(self, ventPadre, cursor, screen, clock, anchoVentana,
                 altoVentana):

        self.ventanaPadre = ventPadre

        self.nombre = ""
        self.colegio = ""
        self.edad = ""

        self.ancho = anchoVentana
        self.alto = altoVentana

        self.dirImagenes = os.path.join("imagenes", "personajes")

        self.cursor = cursor
        self.screen = screen
        self.clock = clock

        imgBtnNino = Servicios.cargarImagen("boton_nino.png", self.dirImagenes)
        imgBtnNinoSelec = Servicios.cargarImagen("boton_nino_selec.png",
                                                 self.dirImagenes)

        imgBtnNina = Servicios.cargarImagen("boton_nina.png", self.dirImagenes)
        imgBtnNinaSelec = Servicios.cargarImagen("boton_nina_selec.png",
                                                 self.dirImagenes)

        imgBtnRegresar = Servicios.cargarImagen("boton_regresar.png",
                                                "imagenes")
        imgBtnRegresarSelec = Servicios.cargarImagen(
            "boton_regresar_selec.png", "imagenes")

        imgBtnGuardar = Servicios.cargarImagen("boton_personaje.png",
                                               self.dirImagenes)
        imgBtnGuardarSelec = Servicios.cargarImagen(
            "boton_personaje_selec.png", self.dirImagenes)

        self.letreroIncorrecto = pygame.image.load(
            os.path.join("imagenes", "personajes",
                         "letreroIncorrecto.png")).convert_alpha()
        self.transparente = pygame.image.load(
            os.path.join("imagenes", "transparente.png")).convert_alpha()
        self.botonContinuar = Boton.BotonContinuar()
        self.mouse = Cursor.Mouse()

        self.initFont()

        self.personaje = self.ventanaPadre.personaje

        self.anchoPersonaje = 300

        self.numPersonaje = 1

        self.origen_x = 450
        self.origen_y = 100

        self.btnNino = Boton.Boton(imgBtnNino, imgBtnNinoSelec, 600 - 220,
                                   self.origen_y - 50)
        self.btnNina = Boton.Boton(imgBtnNina, imgBtnNinaSelec, 600 + 3,
                                   self.origen_y - 50)

        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec,
                                       (self.ancho - 214 - 10), 10)

        self.btnGuardar = Boton.Boton(imgBtnGuardar, imgBtnGuardarSelec,
                                      (self.ancho - 330 - 10),
                                      (self.alto - 74 - 10))