Esempio n. 1
0
    def _init_movement_objects(self):
        self.pacman = pacman.Pacman(self, self.mixer)
        self.movement_objects.append(self.pacman)

        for index, ghost_name in enumerate(constants.GHOST_NAMES):
            self.movement_objects.append(enemy.Enemy(
                ghost_name, self.map_objects['spawn_ghosts'][index], self))
Esempio n. 2
0
    def main_loop(self):
        pacman = PAC.Pacman()

        clock = pygame.time.Clock()
        while True:
            print(CONST.gameMap)

            time = clock.tick(CONST.FPS)
            keys = pygame.key.get_pressed()

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

            #**UPDATES**
            pacman.update(time, keys)

            #**DRAW**
            #self.screen.blit(self.background_image, (0, 0))
            self.drawMap()

            pacman.draw(self.screen)
            #self.screen.blit(pacman.image, pacman.rect)
            pygame.display.flip()

        return 0
Esempio n. 3
0
    def __init__(self, pacman_agent):

        self.pacman_agent = pacman_agent

        self.grid   = grid.Grid()
        self.pacman = pacman.Pacman(grid.PACMAN_STARTPOS, 0, 0)

        self.blinky = ghost.Blinky(grid.GHOST_STARTPOS, 0, 0)
        self.inky   = ghost.Inky(grid.GHOST_STARTPOS, 0, 0)
        self.pinky  = ghost.Pinky(grid.GHOST_STARTPOS, 0, 0)
        self.clyde  = ghost.Clyde(grid.GHOST_STARTPOS, 0, 0)

        self.ghosts = pygame.sprite.Group()
        self.ghost_house = pygame.sprite.Group()

        self.ghosts.add(self.blinky)
        self.ghost_house.add(self.inky)
        self.ghost_house.add(self.pinky)
        self.ghost_house.add(self.clyde)

        pygame.time.set_timer(CHANGESTATEEVENT, int(self.ghosts_state * 1000))
        pygame.time.set_timer(GHOSTHOUSEEVENT, int(GHOSTHOUSETIME * 1000))


        self._font = pygame.font.Font(globals.FONT, globals.FONT_SIZE)
Esempio n. 4
0
 def test_death(self):
     pacman = pac.Pacman(0, 0)
     pacman.energizer = True
     pacman.rect.x = pacman.rect.y = 16
     pacman.current_dir = 'up'
     pacman.dead(f.Field('tests/lvl1.txt'))
     self.assertFalse(pacman.energizer)
     self.assertEqual(pacman.current_dir, 'left')
     self.assertEqual(pacman.lifes_count, 2)
     self.assertEqual((pacman.rect.x, pacman.rect.y), (0, 0))
Esempio n. 5
0
def init():
    global orange_ghosts_num, player

    player = pacman.Pacman()

    for i in range(stats.blue_ghosts_num):
        objects.append(ghost.BlueGhost())

    for i in range(stats.red_ghosts_num):
        objects.append(ghost.RedGhost())

    for i in range(stats.green_ghosts_num):
        objects.append(ghost.GreenGhost())

    orange_ghosts_num = stats.orange_ghosts_num

    not_moving_objects.start_fruit_thread()
Esempio n. 6
0
    def launch(self):

        self.field = field.Field(self.game.window, self.game.CELL_WIDTH)

        self.game.all = pygame.sprite.RenderUpdates()
        pacman.Pacman.container = self.game.all
        img = pacman.load_image("pacman.png")
        img = pygame.transform.scale(img, (self.game.CELL_WIDTH, self.game.CELL_WIDTH))
        self.pacman = pacman.Pacman(pygame, Vector2D(100, 100), img, Vector2D(1, 0), 0)

        print(self.field.graph.keys())

        self.ghosts.append(ghost.Ghost(1, self.field.graph, self.game.window, self.game.CELL_WIDTH))
        self.ghosts.append(ghost.Ghost(2, self.field.graph, self.game.window, self.game.CELL_WIDTH))
        self.ghosts.append(ghost.Ghost(3, self.field.graph, self.game.window, self.game.CELL_WIDTH))
        self.ghosts.append(ghost.Ghost(0, self.field.graph, self.game.window, self.game.CELL_WIDTH))


        self.game.all.update()
        self.game.all.draw(self.game.window)

        self.play()
Esempio n. 7
0
    def __setPacmans(self, pCords):
        pacmans = []
        for cord in pCords:
            pacmans += [pacman.Pacman(cord)]

        return pacmans
Esempio n. 8
0
    def run(self):
        
        if self.intro:
            self.sonido.stop()
            self.audio.play()
          
        self.xSelector = 0
        self.ySelector = -200
        
        resource.set_images_path(self.dirImagenes)
        # imgBtnSilencio = Servicios.cargarImagen("icono_silencio.png", self.dirImagenes)
        # imgBtnSilencioSelec = Servicios.cargarImagen("icono_silencio_selec.png", self.dirImagenes)
        imgBtnSilencio = resource.get_image("icono_silencio.png")
        imgBtnSilencioSelec = resource.get_image("icono_silencio_selec.png")
        self.btnSilencio = Boton.Boton(imgBtnSilencio, imgBtnSilencioSelec, self.xSelector, self.ySelector)
        
        imgBtnSilencioGris = resource.get_image("icono_silencio_gris.png")
        self.btnSilencioGris = Boton.Boton(imgBtnSilencioGris, imgBtnSilencioSelec, self.xSelector, self.ySelector)
        
        # imgBtnCuento = Servicios.cargarImagen("icono_cuento.png", self.dirImagenes)
        # imgBtnCuentoSelec = Servicios.cargarImagen("icono_cuento_selec.png", self.dirImagenes)
        imgBtnCuento = resource.get_image("icono_cuento.png")
        imgBtnCuentoSelec = resource.get_image("icono_cuento_selec.png")
        self.btnCuento = Boton.Boton(imgBtnCuento, imgBtnCuentoSelec, self.xSelector + 65, self.ySelector)
        
        imgBtnCuentoGris = resource.get_image("icono_cuento_gris.png")
        self.btnCuentoGris = Boton.Boton(imgBtnCuentoGris, imgBtnCuentoSelec, self.xSelector + 65, self.ySelector)
        
        # imgBtnCita = Servicios.cargarImagen("icono_cita.png", self.dirImagenes)
        # imgBtnCitaSelec = Servicios.cargarImagen("icono_cita_selec.png", self.dirImagenes)
        imgBtnCita = resource.get_image("icono_cita.png")
        imgBtnCitaSelec = resource.get_image("icono_cita_selec.png")
        self.btnCita = Boton.Boton(imgBtnCita, imgBtnCitaSelec, self.xSelector, self.ySelector + 65)
        
        imgBtnCitaGris = resource.get_image("icono_cita_gris.png")
        self.btnCitaGris = Boton.Boton(imgBtnCitaGris, imgBtnCitaSelec, self.xSelector, self.ySelector + 65)
        
        # imgBtnCanto = Servicios.cargarImagen("icono_canto.png", self.dirImagenes)
        # imgBtnCantoSelec = Servicios.cargarImagen("icono_canto_selec.png", self.dirImagenes)
        imgBtnCanto = resource.get_image("icono_canto.png")
        imgBtnCantoSelec = resource.get_image("icono_canto_selec.png")
        self.btnCanto = Boton.Boton(imgBtnCanto, imgBtnCantoSelec, self.xSelector + 65, self.ySelector + 65) 
        
        imgBtnCantoGris = resource.get_image("icono_canto_gris.png")
        self.btnCantoGris = Boton.Boton(imgBtnCantoGris, imgBtnCantoSelec, self.xSelector + 65, self.ySelector + 65) 
        
        if self.mandala is None:
            self.mandala = VentanaMandala.VentanaMandala(self.cursor, self.screen, self.clock, self.ancho, self.alto, "Flor", self)
        
        resource.set_images_path(os.path.join("imagenes"))
        # fondo = Servicios.cargarImagen("Fondo.jpg", os.path.join("imagenes"))
        fondo = resource.get_image("Fondo.jpg")
        
        x = self.ancho - (self.ancho / 2) - (self.background.get_width() / 2)
        y = self.alto - (self.alto / 2) - (self.background.get_height() / 2)
        
        fuenteTitulo = pygame.font.SysFont("helvetica", 30, True)
        
        textoNombre = self.fuenteGrande.render("Bienvenido(a) %s" % (self.personaje.nombre), 1, (255, 255, 255))
        textoInfo = self.fuenteGrande.render("Selecciona un valor presionando uno de los iconos", 1, (255, 255, 255))
        
        selectorAmor = False
        selectorRectitud = False
        selectorPaz = False
        selectorVerdad = False
        selectorNoViolencia = False
        
        valorSelector = ""
        
        #=======================================================================
        # print self.pasoSilencioAmor
        # print self.pasoCuentoAmor
        # print self.pasoCitaAmor
        # print self.pasoCantoAmor
        #=======================================================================
        
        self.pasoAmor = self.pasoSilencioAmor and self.pasoCuentoAmor and self.pasoCitaAmor and self.pasoCantoAmor
        self.pasoRectitud = self.pasoSilencioRectitud and self.pasoCuentoRectitud and self.pasoCitaRectitud and self.pasoCantoRectitud
        self.pasoPaz = self.pasoSilencioPaz and self.pasoCuentoPaz and self.pasoCitaPaz and self.pasoCantoPaz
        self.pasoVerdad = self.pasoSilencioVerdad and self.pasoCuentoVerdad and self.pasoCitaVerdad and self.pasoCantoVerdad
        self.pasoNoViolencia = self.pasoSilencioNoViolencia and self.pasoCuentoNoViolencia and self.pasoCitaNoViolencia and self.pasoCantoNoViolencia
        
        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):
                        salir = True 
                        self.menu.run()
                    if self.cursor.colliderect(self.msjInicio.btn.rect):
                        self.msjInicio.visible = False
                        self.audio.stop()
                        self.sonido.play(-1)
                        self.intro = False
# SILENCIO            
                    if self.cursor.colliderect(self.btnSilencioGris.rect) or self.cursor.colliderect(self.btnSilencio.rect):
                        
                        if valorSelector == "amor":
                            salir = True
                            self.sonido.stop()
                            self.mandala.setTipo("Flor")
                            self.mandala.run()
                            
                        if valorSelector == "rectitud":
                                salir = True
                                self.sonido.stop()
                                self.mandala.setTipo("Sol")
                                self.mandala.run()
                        
                        if valorSelector == "paz":
                                salir = True
                                self.sonido.stop()
                                self.mandala.setTipo("Hojas")
                                self.mandala.run()
                                
                        if valorSelector == "verdad":
                                salir = True
                                self.sonido.stop()
                                self.mandala.setTipo("Nino")
                                self.mandala.run()
                                
                        if valorSelector == "noviolencia":
                                salir = True
                                self.sonido.stop()
                                self.mandala.setTipo("Flor2")
                                self.mandala.run()
# CUENTO                               
                    if self.cursor.colliderect(self.btnCuentoGris.rect) or self.cursor.colliderect(self.btnCuento.rect):
                        
                        if valorSelector == "amor":
                            salir = True
                            self.sonido.stop()
                            self.cuento = Amor.Amor(self.cursor, self.screen, self.clock, self)
                            self.cuento.run()
                            
                        if valorSelector == "rectitud":
                                salir = True
                                self.sonido.stop()
                                self.cuento = Rectitud.Rectitud(self.cursor, self.screen, self.clock, self)
                                self.cuento.run()
                        
                        if valorSelector == "paz":
                                salir = True
                                self.sonido.stop()
                                self.cuento = pazSemillas.PazSemillas(self.cursor, self.screen, self.clock, self)
                                self.cuento.run()
                                
                        if valorSelector == "verdad":
                                salir = True
                                self.sonido.stop()
                                self.cuento = pacman.Pacman(self.cursor, self.screen, self.clock, self)
                                self.cuento.run()
                                
                        if valorSelector == "noviolencia":
                                salir = True
                                self.sonido.stop()
                                self.cuento = puzzle.Puzzle(self.cursor, self.screen, self.clock, self)
                                self.cuento.run()
# CITA                                
                    if self.cursor.colliderect(self.btnCitaGris.rect) or self.cursor.colliderect(self.btnCita.rect):
                        
                        if valorSelector == "amor":
                            salir = True
                            self.sonido.stop()
                            if self.cita is None :
                                self.cita = Cita.Cita(self.screen, self.clock, self.cursor, 1, self)
                            self.cita.setTipo(1)
                            self.cita.run()
                            
                        if valorSelector == "rectitud":
                                salir = True
                                self.sonido.stop()
                                if self.cita is None :
                                    self.cita = Cita.Cita(self.screen, self.clock, self.cursor, 2, self)
                                self.cita.setTipo(2)
                                self.cita.run()
                        
                        if valorSelector == "paz":
                                salir = True
                                self.sonido.stop()
                                if self.cita is None :
                                    self.cita = Cita.Cita(self.screen, self.clock, self.cursor, 3, self)
                                self.cita.setTipo(3)
                                self.cita.run()
                                
                        if valorSelector == "verdad":
                                salir = True
                                self.sonido.stop()
                                if self.cita is None :
                                    self.cita = Cita.Cita(self.screen, self.clock, self.cursor, 4, self)
                                self.cita.setTipo(4)
                                self.cita.run()
                                
                        if valorSelector == "noviolencia":
                                salir = True
                                self.sonido.stop()
                                if self.cita is None :
                                    self.cita = Cita.Cita(self.screen, self.clock, self.cursor, 5, self)
                                self.cita.setTipo(5)
                                self.cita.run()
# CANTO                    
                    if self.cursor.colliderect(self.btnCantoGris.rect) or self.cursor.colliderect(self.btnCanto.rect):
                        
                        if valorSelector == "amor":
                            salir = True
                            self.sonido.stop()
                            self.canto = Karaoke.Karaoke(self.cursor, self.screen, self.clock, 1, self)
                            self.canto.run()
                            
                        if valorSelector == "rectitud":
                                salir = True
                                self.sonido.stop()
                                self.canto = Karaoke.Karaoke(self.cursor, self.screen, self.clock, 2, self)
                                self.canto.run()
                        
                        if valorSelector == "paz":
                                salir = True
                                self.sonido.stop()
                                self.canto = Karaoke.Karaoke(self.cursor, self.screen, self.clock, 3, self)
                                self.canto.run()
                                
                        if valorSelector == "verdad":
                                salir = True
                                self.sonido.stop()
                                self.canto = Karaoke.Karaoke(self.cursor, self.screen, self.clock, 4, self)
                                self.canto.run()
                                
                        if valorSelector == "noviolencia":
                                salir = True
                                self.sonido.stop()
                                self.canto = Karaoke.Karaoke(self.cursor, self.screen, self.clock, 5, self)
                                self.canto.run()

                    if self.cursor.colliderect(self.areaAmor):
                        print "Click en amor"
                        
                        self.sonido2 = self.sonidoAmor
                        # self.sonido2 = Servicios.cargarSonido("amor_instrum.ogg", os.path.join("audios"))
                        
                        valorSelector = "amor"
                        
                        self.xSelector = 658 + 10
                        self.ySelector = 523 + 15
                        
                        if self.pasoSilencioAmor:
                            self.btnSilencio.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencioGris.setCoord(0, -200)
                        else:
                            self.btnSilencioGris.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencio.setCoord(0, -200)
                        
                        if self.pasoCuentoAmor:
                            self.btnCuento.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuentoGris.setCoord(0, -200)
                        else:
                            self.btnCuentoGris.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuento.setCoord(0, -200)
                        if self.pasoCitaAmor:
                            self.btnCita.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCitaGris.setCoord(0, -200)
                        else:
                            self.btnCitaGris.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCita.setCoord(0, -200)
                        if self.pasoCantoAmor:
                            self.btnCanto.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCantoGris.setCoord(0, -200)
                        else:
                            self.btnCantoGris.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCanto.setCoord(0, -200)
                        # salir = True
                        # self.sonido.stop()
                        # self.mandala.setTipo("Flor")
                        # self.mandala.run()
                        
                    
                    if self.cursor.colliderect(self.areaRectitud):
                        print "Click en rectitud"
                        
  #------                      if self.pasoAmor:
                        
                        self.sonido2 = self.sonidoRectitud
                        # self.sonido2 = Servicios.cargarSonido("rectitud_instrum.ogg", os.path.join("audios"))
                        
                        valorSelector = "rectitud"
                                
                        self.xSelector = 743 + 10
                        self.ySelector = 275 + 15
                                
                        if self.pasoSilencioRectitud:
                            self.btnSilencio.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencioGris.setCoord(0, -200)
                        else:
                            self.btnSilencioGris.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencio.setCoord(0, -200)
                        
                        if self.pasoCuentoRectitud:
                            self.btnCuento.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuentoGris.setCoord(0, -200)
                        else:
                            self.btnCuentoGris.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuento.setCoord(0, -200)
                        if self.pasoCitaRectitud:
                            self.btnCita.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCitaGris.setCoord(0, -200)
                        else:
                            self.btnCitaGris.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCita.setCoord(0, -200)
                        if self.pasoCantoRectitud:
                            self.btnCanto.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCantoGris.setCoord(0, -200)
                        else:
                            self.btnCantoGris.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCanto.setCoord(0, -200)
                            
                            # if self.pasoAmor:
                            # self.mandala.setTipo("Sol")
                            # self.sonido.stop()
                            # salir = True
                            # self.mandala.run()
                            
                    if self.cursor.colliderect(self.areaPaz):
                        print "Click en paz"
                        
  #------                      if self.pasoRectitud:
                        
                        self.sonido2 = self.sonidoPaz
                        # self.sonido2 = Servicios.cargarSonido("paz_instrum.ogg", os.path.join("audios"))
                        
                        valorSelector = "paz"
                                
                        self.xSelector = 531 + 10
                        self.ySelector = 118 
                                
                        if self.pasoSilencioPaz:
                            self.btnSilencio.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencioGris.setCoord(0, -200)
                        else:
                            self.btnSilencioGris.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencio.setCoord(0, -200)
                        
                        if self.pasoCuentoPaz:
                            self.btnCuento.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuentoGris.setCoord(0, -200)
                        else:
                            self.btnCuentoGris.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuento.setCoord(0, -200)
                        if self.pasoCitaPaz:
                            self.btnCita.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCitaGris.setCoord(0, -200)
                        else:
                            self.btnCitaGris.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCita.setCoord(0, -200)
                        if self.pasoCantoPaz:
                            self.btnCanto.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCantoGris.setCoord(0, -200)
                        else:
                            self.btnCantoGris.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCanto.setCoord(0, -200)
                            # if self.pasoRectitud:
                            # self.mandala.setTipo("Hojas")
                            # salir = True
                            # self.sonido.stop()
                            # self.mandala.run()
                            
                    if self.cursor.colliderect(self.areaVerdad):
                        print "Click en verdad"
                        
  #------                      if self.pasoPaz:
                        
                        self.sonido2 = self.sonidoVerdad
                        # self.sonido2 = Servicios.cargarSonido("noViolencia_instrum.ogg", os.path.join("audios"))
                        
                        valorSelector = "verdad"
                                
                        self.xSelector = 316 + 10
                        self.ySelector = 275 + 15
                                
                        if self.pasoSilencioVerdad:
                            self.btnSilencio.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencioGris.setCoord(0, -200)
                        else:
                            self.btnSilencioGris.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencio.setCoord(0, -200)
                        
                        if self.pasoCuentoVerdad:
                            self.btnCuento.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuentoGris.setCoord(0, -200)
                        else:
                            self.btnCuentoGris.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuento.setCoord(0, -200)
                        if self.pasoCitaVerdad:
                            self.btnCita.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCitaGris.setCoord(0, -200)
                        else:
                            self.btnCitaGris.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCita.setCoord(0, -200)
                        if self.pasoCantoVerdad:
                            self.btnCanto.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCantoGris.setCoord(0, -200)
                        else:
                            self.btnCantoGris.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCanto.setCoord(0, -200)
                            # if self.pasoPaz:
                            # self.mandala.setTipo("Nino")
                            # self.sonido.stop()
                            # salir = True
                            # self.mandala.run()
                    
                    if self.cursor.colliderect(self.areaNoViolencia):
                        print "Click en No violencia"
                        
  #------                      if self.pasoVerdad:
                        
                        self.sonido2 = self.sonidoNoViolencia
                        # self.sonido2 = Servicios.cargarSonido("noViolencia_instrum.ogg", os.path.join("audios"))
                        
                        valorSelector = "noviolencia"
                            
                        self.xSelector = 397 + 10
                        self.ySelector = 523 + 15
                                
                        if self.pasoSilencioNoViolencia:
                            self.btnSilencio.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencioGris.setCoord(0, -200)
                        else:
                            self.btnSilencioGris.setCoord(self.xSelector, self.ySelector)
                            self.btnSilencio.setCoord(0, -200)
                        
                        if self.pasoCuentoNoViolencia:
                            self.btnCuento.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuentoGris.setCoord(0, -200)
                        else:
                            self.btnCuentoGris.setCoord(self.xSelector + 65, self.ySelector)
                            self.btnCuento.setCoord(0, -200)
                        if self.pasoCitaNoViolencia:
                            self.btnCita.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCitaGris.setCoord(0, -200)
                        else:
                            self.btnCitaGris.setCoord(self.xSelector, self.ySelector + 65)
                            self.btnCita.setCoord(0, -200)
                        if self.pasoCantoNoViolencia:
                            self.btnCanto.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCantoGris.setCoord(0, -200)
                        else:
                            self.btnCantoGris.setCoord(self.xSelector + 65, self.ySelector + 65)
                            self.btnCanto.setCoord(0, -200)
                            # if self.pasoVerdad:
                            # self.mandala.setTipo("Flor2")
                            # self.sonido.stop()
                            # salir = True
                            # self.mandala.run()
                        
                    print valorSelector
                    
            
            self.clock.tick(60)
            
            self.cursor.update()
            
            self.screen.blit(fondo, (0, 0))
            
            self.screen.blit(self.background, (x, y))
            
            valorElegido = ""
            
            self.btnRegresar.update(self.screen, self.cursor)
            
            self.msjInicio.update(self.screen, self.cursor)
            
            if self.intro:
                self.msjInicio.visible = True
                #self.btnRegresar.update(self.screen, self.cursor)
            else:
                
                if self.pasoAmor:
                    self.screen.blit(self.imagenAmor, (x, y))
                # else:
                    # self.screen.blit(self.candadoRectitud, (x, y))
                    
                if self.pasoRectitud:
                    self.screen.blit(self.imagenRectitud, (x, y))
                # else:
                    # self.screen.blit(self.candadoPaz, (x, y))
                
                if self.pasoPaz:
                    self.screen.blit(self.imagenPaz, (x, y))
                # else:
                    # self.screen.blit(self.candadoVerdad, (x, y))
                    
                if self.pasoVerdad:
                    self.screen.blit(self.imagenVerdad, (x, y))
                # else:
                    # self.screen.blit(self.candadoNoViolencia, (x, y))
                    
                if self.pasoNoViolencia:
                    self.screen.blit(self.imagenNoViolencia, (x, y))
                    
                    
                
                
                if self.cursor.colliderect(self.areaAmor):
                    valorElegido = "    AMOR    "
                    self.screen.blit(self.imagenAmorSel, (x, y))
                    
                if self.cursor.colliderect(self.areaRectitud):
                    valorElegido = "  RECTITUD  "
                    self.screen.blit(self.imagenRectitudSel, (x, y))
                    if not self.pasoAmor:
                        self.screen.blit(self.candadoRectitud, (x, y))
                        
                if self.cursor.colliderect(self.areaPaz):
                    valorElegido = "     PAZ    "
                    self.screen.blit(self.imagenPazSel, (x, y))
                    if not self.pasoRectitud:
                        self.screen.blit(self.candadoPaz, (x, y))
                    
                if self.cursor.colliderect(self.areaVerdad):
                    valorElegido = "   VERDAD   "
                    self.screen.blit(self.imagenVerdadSel, (x, y))
                    if not self.pasoPaz:
                        self.screen.blit(self.candadoVerdad, (x, y))
                    
                if self.cursor.colliderect(self.areaNoViolencia):
                    valorElegido = "NO VIOLENCIA"
                    self.screen.blit(self.imagenNoViolenciaSel, (x, y))
                    if not self.pasoVerdad:
                        self.screen.blit(self.candadoNoViolencia, (x, y))
                
                
                self.btnSilencio.update(self.screen, self.cursor)
                self.btnSilencioGris.update(self.screen, self.cursor)
                self.btnCuento.update(self.screen, self.cursor)
                self.btnCuentoGris.update(self.screen, self.cursor)
                self.btnCita.update(self.screen, self.cursor)
                self.btnCitaGris.update(self.screen, self.cursor)
                self.btnCanto.update(self.screen, self.cursor)
                self.btnCantoGris.update(self.screen, self.cursor)
                
                
                textoValor = fuenteTitulo.render(valorElegido, 1, (255, 255, 255))
                self.screen.blit(textoValor, (530, 770))
                
                self.screen.blit(textoNombre, (10, 3))
                self.screen.blit(textoInfo, (10, 33))
                
                #===================================================================
                # pygame.draw.rect (self.screen , (100, 100, 100) , self.areaPaz, 2)
                # pygame.draw.rect (self.screen , (100, 100, 100) , self.areaRectitud, 2)
                # pygame.draw.rect (self.screen , (100, 100, 100) , self.areaAmor, 2)
                # pygame.draw.rect (self.screen , (100, 100, 100) , self.areaNoViolencia, 2)
                # pygame.draw.rect (self.screen , (100, 100, 100) , self.areaVerdad, 2)
                #===================================================================

            pygame.display.update()
Esempio n. 9
0
in_first_level = True
in_menu = True
win = False
ran_once = False
x = 0

# animation variables
flash_text_counter = 0
gv.pacman_tick_counter = 0

# generating a screen
gv.screen = pygame.display.set_mode(gv.screensize)
pygame.display.set_caption("Daniel's PacMan")

# create pacman and ghost objects
gv.pacman = pm.Pacman([480, 200])
ghost_starting_positions = [[30, 30], [950, 30], [30, 450], [950, 450]]
ghost_second_level_positions = [[30, 30], [950, 30], [30, 450], [950, 450]]
ghost_third_level_positions = [[30, 30], [950, 30], [30, 450], [950, 450]]
for ghost_type in range(4):
    gv.ghosts.append(gh.Ghost(ghost_type, ghost_starting_positions[ghost_type]))

# create pellet lists
ani.read_pellet_images()

# menu loop
while in_menu:
    gv.screen.fill((0, 0, 0))
    if flash_text_counter == 0:
        flash_text_counter = 1
    else:
Esempio n. 10
0
#206


#funkcja rysująca grę w aktualnym stanie (np po poruszeniu Pacmana)
def redrawGame():
    screen.blit(bg, (0, 0))
    pacman.draw(screen, pacman.x + pacman.WalkCount_x,
                pacman.y + pacman.WalkCount_y, pacman.direction)
    draw_coins()
    ghost_1.draw(1, screen, ghost_1.x + ghost_1.WalkCount_x,
                 ghost_1.y + ghost_1.WalkCount_y, ghost_1.direction)
    ghost_2.draw(2, screen, ghost_2.x + ghost_2.WalkCount_x,
                 ghost_2.y + ghost_2.WalkCount_y, ghost_2.direction)
    ghost_3.draw(3, screen, ghost_3.x + ghost_3.WalkCount_x,
                 ghost_3.y + ghost_3.WalkCount_y, ghost_3.direction)

    draw_text('Twój wynik: {}'.format(pacman.current_score), screen, [60, 0],
              18, WHITE, START_FONT)
    pg.display.update()


#Tworzymy postać Pacmana i przypisujemy go do pacman
pacman = pacman.Pacman(30, 30, 1, 3, 0, 0, 0)
#tworzymy przeciwników
ghost_1 = ghost.Ghost(1, 270, 30, 2, 0, 0)
ghost_2 = ghost.Ghost(2, 570, 600, 2, 0, 0)
ghost_3 = ghost.Ghost(3, 570, 30, 2, 0, 0)

#GłóWna pętla, w której wywołóujemy grę
START_SCREEN()
MainLoop()
Esempio n. 11
0
def init_widgets_list():
    # prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
    widgets_list = [

        widget.GroupBox(
            font="Inconsolata",
            fontsize=18,
            borderwidth=0,
            active="#3CBC3C",
            inactive="#FF8C00",
            rounded=False,
            highlight_method="block",
            this_current_screen_border=colors[7],
            this_screen_border=colors[3],
            other_current_screen_border=colors[0],
            other_screen_border=colors[0],
            foreground=colors[8],
            background=colors[1]
        ),

        # widget.Prompt(
        #     prompt=prompt,
        #     font="Ubuntu Mono",
        #     padding=12,
        #     foreground=colors[8],
        #     background=colors[1]
        # ),

        # widget.Sep(
        #     linewidth=0,
        #     padding=12,
        #     foreground=colors[2],
        #     background=colors[1]
        # ),


        widget.WindowName(
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        # widget.Cmus(),

        mpdwidget.Mpd(
            fmt_playing='%f [%v%%] %s',
            fmt_stopped='⏹️',
            reconnect=True,
            reconnect_interval=1,
            foreground_progress="#ff8c00",
            **widget_defaults
        ),

        # widget.Sep(
        #     linewidth=1,
        #     padding=0,
        #     foreground=colors[8],
        #     background=colors[1]
        # ),

        # arcobattery2.BatteryIcon(
        #     battery_name='BAT1',
        #     scale=0.6,
        #     y_poss=4,
        #     padding=0,
        #     theme_path=home + "/.config/qtile/battery_icons/"
        # ),

        widget.Sep(
            **widget_sep
        ),

        widget.CurrentLayoutIcon(
            scale=0.5,
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        # widget.CheckUpdates(
        #     display_format="a: {updates}"),

        # widget.maildir(
        # maildirPath="~/.local/share/mail/krive79",
        # subFolders=[“path”: “INBOX”, “label”: “Home mail”],
        # separator=" ",
        # ),

        wttrweather.WttrWeather(
            location='Fábiánháza',
            format='2',
            units='&m',
            execute=myTerm + ' -e weatc',
            update_interval=600,
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        widget.TextBox(
            text="📦",
            **widget_defaults
        ),

        pacman.Pacman(
            execute=myTerm + ' -e updatepackage',
            update_interval=600,
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        net.Net(
            icon_up="⬆",
            icon_down="⬇",
            interface="enp0s31f6",
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        widget.TextBox(
            text="🚚",
            **widget_defaults
        ),

        memory.Memory(
            fmt='{MemUsed} MB\n{Memsza}%',
            execute='urxvt -e htop',
            update_interval=1,
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        widget.TextBox(
            text="🌡️",
            **widget_defaults
        ),

        widget.ThermalSensor(
            tag_sensor="Package id 0",
            **widget_defaults
        ),

        custom.Cpu(
            **widget_defaults),

        widget.Sep(
            **widget_sep
        ),

        widget.Volume(
            emoji=True,
            **widget_defaults
        ),

        widget.Volume(
            step=5,
            volume_app="qasmixer",
            **widget_defaults
        ),

        # widget.TextBox(
        #          font="Ubuntu Bold",
        #          text=" ☵",
        #          padding = 6,
        #          foreground=colors[6],
        #          background=colors[0],
        #          fontsize=14
        #          ),

        widget.Sep(
            **widget_sep
        ),

        # widget.TextBox(
        #         font="Ubuntu Bold",
        #         text=" 🕒",
        #         foreground=colors[6],
        #         background=colors[1],
        #         padding = 6,
        #         fontsize=14
        #         ),

        widget.TextBox(
            text="⏳",
            **widget_defaults
        ),

        widget.Clock(
            format="%Y-%m-%d\n%H:%M",
            **widget_defaults
        ),

        widget.Sep(
            **widget_sep
        ),

        widget.Systray(
            **widget_defaults
        ),

        widget.Sep(
            linewidth=0,
            padding=10,
            foreground=colors[2],
            background=colors[1]),
    ]
    return widgets_list
Esempio n. 12
0
 def setUp(self):
     self.pacmanObj = Pacman.Pacman(10, True, 5)