Ejemplo n.º 1
0
    def __init__(self):
        self.numPo = 0
        self.numMa = 0
        self.numEn = 0

        self.recursos = [rs.Horno(), rs.Cuchillos(), rs.Licuadora()]
        self.cola1 = queue.Queue()
        self.cola2 = queue.Queue()
        self.cola3 = queue.Queue()

        self.colaProcesadores = queue.Queue()
        self.procesador1 = Chef((width - 900, height), 1, self.cola1)
        self.procesador2 = Chef((width - 700, height), 2, self.cola2)
        self.procesador3 = Chef((width - 500, height), 3, self.cola3)

        pygame.init()
        pygame.mixer.init()

        self.fondo = pygame.image.load("imagenes/cocina.png")
        self.intro = pygame.image.load("imagenes/intro.png")
        self.fondorect = self.fondo.get_rect()
        self.introrect = self.intro.get_rect()

        pygame.display.set_caption("Chef Race (Universidad Distrital)")
        self.pizarra = pygame.image.load("imagenes/pizarra.png")
        self.sInicio = util.cargar_sonido('sonidos/inicio.wav')
        self.sHorno = util.cargar_sonido('sonidos/horno.wav')
        self.sCuchillo = util.cargar_sonido('sonidos/cuchillo.wav')
        self.sLicuadora = util.cargar_sonido('sonidos/licuadora.wav')
        self.sPrincipal = util.cargar_sonido('sonidos/principal.wav')

        self.pizarra1 = Pizarra((width - 900, height))
        self.pizarra2 = Pizarra((width - 700, height))
        self.pizarra3 = Pizarra((width - 500, height))
        self.receta1 = Receta((width, height))
        self.receta2 = Receta((width + 200, height))
        self.receta3 = Receta((width + 400, height))

        self.comida1 = PolloConPapas(000, self.recursos[0], size)
        self.comida2 = Ensalada(111, self.recursos[1], size)
        self.comida3 = Malteada(222, self.recursos[2], size)

        self.listaChefs = [
            self.procesador1, self.procesador2, self.procesador3
        ]
        self.listaPizarras = [self.pizarra1, self.pizarra2, self.pizarra3]
        self.listaRecetas = [self.receta1, self.receta2, self.receta3]
        self.listaComida = [self.comida1, self.comida2, self.comida3]
        self.cuchillos = CuchillosIma(size)
        self.licuadora = LicuadoraIma(size)
        self.horno = HornoIma(size)

        self.reloj = pygame.time.Clock()
        self.fuente1 = pygame.font.Font(None, 70)
        self.fuente2 = pygame.font.Font(None, 25)
        self.textoBienvenida = self.fuente1.render("Bienvenido a Chef Race UD",
                                                   1, (255, 255, 255))
        self.textoAutor1 = self.fuente2.render("Marlon Arias", 1, (0, 0, 0))
        self.textoAutor2 = self.fuente2.render("David Amado", 1, (0, 0, 0))
        self.textoAutor3 = self.fuente2.render("Realizado por:", 1, (0, 0, 0))
Ejemplo n.º 2
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("HomerRun")
    background_image = util.cargar_imagen('imagenes/Springfield.jpg')
    pierde_vida = util.cargar_sonido('sonidos/Douh.wav')
    tema = util.cargar_sonido('sonidos/simpson.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Homero()
    control = 0
    villano = [
        Barril((100, 10), randint(1, 5)),
        Barril((100, 79), randint(1, 5)),
        Barril((200, 148), randint(1, 5)),
        Barril((300, 217), randint(1, 5)),
        Barril((100, 286), randint(1, 5))
    ]

    while True:
        fuente = pygame.font.Font(None, 25)
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1,
                                     (0, 0, 0))
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1, (0, 0, 0))

        heroe.update()

        for n in villano:
            n.update()

        for n in villano:

            if heroe.rect.colliderect(n.rect) and control == 0:
                control = 1
                heroe.image = heroe.imagenes[3]
                pierde_vida.play()
                if heroe.vida > 0:
                    heroe.vida = heroe.vida + 1
                    print heroe.vida
                if heroe.vida == 0:
                    tema.play()
                n.velocidad = randint(1, 5)

            if heroe.rect.colliderect(n.rect) and control == 1:
                control = 0

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (0, 0))
        screen.blit(texto_puntos, (550, 0))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 3
0
 def __init__(self):
     Sprite.__init__(self);
     self.cargar_imagenes();
     self.sonido_risa = cargar_sonido('risa.wav')
     self.sonido_grito = cargar_sonido('grito.wav')
     self.image = self.normal;
     self.rect = self.rect;
     self.rect.x = 400;
     self.rect.y = 430;
     self.estado_contador = 0;
Ejemplo n.º 4
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    jugando = True
    pygame.display.set_caption("LA GALLINA QUE CRUZA LA CALLE")
    fuente = pygame.font.Font(None, 30)
    background_image = util.cargar_imagen('imagenes/fondo.png')
    background_sound = util.cargar_sonido('sonidos/hen.wav')
    pierde_vida = util.cargar_sonido('sonidos/live.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((100, 90), 7),
        Villano((200, 215), 18),
        Villano((300, 340), 10)
    ]
    background_sound.play(100)
    while jugando:
        heroe.update()
        if heroe.vida <= 0:
            jugando = False
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1,
                                   (250, 250, 250))
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1,
                                     (200, 250, 250))
        for n in villano:
            n.update()
        heroe.image = heroe.imagenes[0]
        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                pygame.time.delay(10)
                heroe.vida -= 1

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        for n in villano:
            screen.blit(n.image, n.rect)
        screen.blit(texto_vida, (20, 10))
        pygame.display.update()
        pygame.time.delay(10)
        """ 
          for n in rect:
            if heroe.rect.height(n.rect):
				heroe.puntos +=1
          """
        screen.blit(texto_puntos, (500, 10))
Ejemplo n.º 5
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
    pygame.display.set_caption( "Juego del Carrito" )
    background_image = util.cargar_imagen('imagenes/fondo.jpg');
    pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
    inicio = util.cargar_sonido ('sonidos/inicio.wav')
    pygame.mouse.set_visible( False )
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    inicio.play()
    villano = [(Villano((randint (450, 850),(120)),randint(10, 15))),
               Villano(((750),(220)),randint(10,15)),               
               Villano(((550),(300)),(20)),
               Villano((randint (450, 850),(120)),randint(5, 10)),
               Villano(((550),(300)),randint(10, 15))]
    
    while True:
        fuente = pygame.font.Font(None,35)
        texto_puntos = fuente.render("Puntos: "+str(heroe.puntos),1,(0,100,250))
        texto_vida = fuente.render("Vida: "+str(heroe.vida),1,(0,100,250))
        
        
        heroe.update()
        
        for n in villano:
			n.update()
            
        
        for n in villano:									
										
            if heroe.vida > 0 and heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                				
                if heroe.vida > 0:
                    heroe.vida=heroe.vida-1                   
                n.velocidad=randint(5, 15)		           
            
        
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0,0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida,(400,450))
        screen.blit(texto_puntos,(100,450))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(55)
Ejemplo n.º 6
0
def game():
      pygame.init()
      pygame.mixer.init()
      screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
      pygame.display.set_caption( "El Gran Laberinto" )
      background_image = util.cargar_imagen('imagenes/fondo.jpg');
      pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
      pygame.mouse.set_visible( False )
      temporizador = pygame.time.Clock()
      heroe = Heroe()
      villano = [Villano((100,120),7),Villano((200,280),10),Villano((300,370),8)]
      while True:
		  heroe.update()
		  for n in villano:
			  n.update()
		  heroe.image = heroe.imagenes[0]
		  for n in villano:
			  if heroe.rect.colliderect(n.rect):
				  heroe.image = heroe.imagenes[1]
				  pierde_vida.play()
		  
		  for event in pygame.event.get():
			  if event.type == pygame.QUIT:
				  sys.exit()
		  screen.blit(background_image, (0,0))
		  screen.blit(heroe.image, heroe.rect)
		  for n in villano:
			  screen.blit(n.image, n.rect)
		  pygame.display.update()
		  pygame.time.delay(10)
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("La Carretera")
    background_image = util.cargar_imagen('imagenes/carreteraverdedf.png')
    pierde_vida = util.cargar_sonido('sonidos/choque.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    carro = Carro()
    obs = [Obs(), Obs(), Obs(), Obs(), Obs(), Obs()]

    while True:
        for n in obs:
            n.update()
            n.renovar()

        fuente = pygame.font.Font(None, 50)
        texto_puntos = fuente.render("Puntos: " + str(carro.puntos), 1,
                                     (255, 255, 255))
        texto_vida = fuente.render("Vida: " + str(carro.vida), 1,
                                   (255, 255, 255))

        carro.update()

        for n in obs:
            if carro.rect.colliderect(n.rect):
                carro.image = carro.imagenes[1]
                carro.arrancon.stop()
                pierde_vida.play()
                if carro.vida > 0:
                    carro.vida = carro.vida - 1

        for n in obs:
            if carro.rect.x == n.rect.x:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 1:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 2:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 3:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 4:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 5:
                carro.puntos += 1
            elif carro.rect.x == n.rect.x + 6:
                carro.puntos += 1

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(carro.image, carro.rect)
        screen.blit(texto_vida, (400, 500))
        screen.blit(texto_puntos, (100, 500))
        for n in obs:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("Campo minado")
    background_image = util.cargar_imagen('imagenes/Fondo-desertico.png')
    pierde_vida = util.cargar_sonido('sonidos/Kbom.mp3')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((100, -10), randint(1, 3)),
        Villano((150, -50), randint(1, 3)),
        Villano((200, -500), randint(1, 3)),
        Villano((250, -300), randint(1, 3)),
        Villano((300, -35), randint(1, 3)),
        Villano((350, -333), randint(1, 3)),
        Villano((400, -536), randint(1, 3)),
        Villano((450, -133), randint(1, 3)),
        Villano((500, -231), randint(1, 3)),
        Villano((550, -3), randint(1, 3)),
        Villano((600, -325), randint(1, 3)),
        Villano((650, -832), randint(1, 3)),
        Villano((225, -400), randint(1, 3)),
        Villano((650, -148), randint(1, 3)),
        Villano((250, -113), randint(1, 3)),
        Villano((400, -251), randint(1, 3)),
        Villano((500, -152), randint(1, 3)),
        Villano((300, -254), randint(1, 3)),
        Villano((200, -1), randint(1, 3)),
        Villano((450, -235), randint(1, 3))
    ]

    while True:
        fuente = pygame.font.Font(None, 30)
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1, (0, 0, 0))

        heroe.update()
        for n in villano:
            n.update()

        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                if heroe.vida > 0:
                    heroe.vida = heroe.vida - 1
                n.velocidad = randint(1, 10)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (400, 620))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("La Carretera")
    background_image = util.cargar_imagen('imagenes/carreteraverdedf.png')
    pierde_vida = util.cargar_sonido('sonidos/choque.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    carro = Carro()
    obs = [
        Obs((1500, 385), randint(3, 10)),
        Obs((1500, 115), randint(3, 10)),
        Obs((1500, 202), randint(3, 10)),
        Obs((1500, 300), randint(3, 10))
    ]

    while True:
        for n in obs:
            n.update()
            n.renovar()

        fuente = pygame.font.Font(None, 50)
        fuentef = pygame.font.Font(None, 100)
        texto_puntos = fuente.render("Puntos: " + str(carro.puntos), 1,
                                     (255, 255, 255))
        texto_vida = fuente.render("Vida: " + str(carro.vida), 1,
                                   (255, 255, 255))
        texto_final = fuentef.render("", 1, (0, 0, 0))

        carro.update()

        for n in obs:
            if carro.rect.colliderect(n.rect) and carro.vida > 0:
                carro.image = carro.imagenes[1]
                pierde_vida.play()
                if carro.vida > 0:
                    carro.vida = carro.vida - 1

        if carro.vida <= 0:
            texto_final = fuentef.render("HAS PERDIDO", 1, (0, 255, 0))
        for n in obs:
            if n.rect.x <= 30 and carro.vida > 0 and n.cont == 0:
                carro.puntos = carro.puntos + 1
                n.cont += 1

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(carro.image, carro.rect)
        screen.blit(texto_vida, (400, 500))
        screen.blit(texto_puntos, (100, 500))
        screen.blit(texto_final, (800, 500))
        for n in obs:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 10
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("Choque")
    background_image = util.cargar_imagen('imagenes/fondonuevo.jpg')
    gameover_image = util.cargar_imagen('imagenes/gameover2.png')
    pierde_vida = util.cargar_sonido('sonidos/barril.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((randint(0, 610), randint(0, 410)), 1),
        Villano((randint(0, 610), randint(0, 410)), 1),
        Villano((randint(0, 610), randint(0, 410)), 1),
        Villano((randint(0, 610), randint(0, 410)), 1),
        Villano((randint(0, 610), randint(0, 410)), 1)
    ]

    while True:
        fuente = pygame.font.Font(None, 25)
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1,
                                     (0, 0, 0))
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1, (0, 0, 0))
        texto_dificultad = fuente.render("A = easy || D = hard", 1, (0, 0, 0))

        heroe.update()

        for n in villano:
            n.update(heroe)

        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[0]
                pierde_vida.play()
                if heroe.vida > 0:
                    heroe.vida = heroe.vida - 1
                n.rect.x = 610
                n.rect.y = randint(1, 410)
            elif n.rect.x <= 20:
                heroe.puntos += 1
                n.rect.x = 610
                n.rect.y = randint(0, 410)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (450, 450))
        screen.blit(texto_puntos, (100, 450))
        screen.blit(texto_dificultad, (250, 450))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 11
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("Autos - Juego")
    background_image = util.cargar_imagen('imagenes/fondo.jpg')
    pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((30, 150), randint(1, 5)),
        Villano((100, 150), randint(1, 5)),
        Villano((200, 220), randint(1, 5)),
        Villano((300, 350), randint(1, 5)),
        Villano((370, 350), randint(1, 5)),
    ]

    while True:
        fuente = pygame.font.Font(None, 25)
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1,
                                     (246, 246, 246))
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1,
                                   (246, 246, 246))
        texto_banner = fuente.render("Esquiva al auto", 1, (246, 246, 246))

        heroe.update()
        for n in villano:
            n.update()

        for n in villano:
            if n.rect.x == heroe.rect.x and heroe.rect.colliderect(
                    n.rect) == False and heroe.vida > 0:
                heroe.puntos = heroe.puntos + 1

        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                if heroe.vida > 0:
                    heroe.vida = heroe.vida - 1

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

        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (430, 455))
        screen.blit(texto_puntos, (120, 455))
        screen.blit(texto_banner, (240, 10))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 12
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
    pygame.display.set_caption( "El Cruce" )
    background_image = util.cargar_imagen('imagenes/fondo.jpg');
    pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
    pygame.mouse.set_visible( False )
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    control=0
    villano = [Villano((100,80),randint(1,10)),
               Villano((100,150),randint(1,10)),
               Villano((200,220),randint(1,10)),
               Villano((300,300),randint(1,10)),
               Villano((100,350),randint(1,10))]
    m = villano[1]
    while True:
        fuente = pygame.font.Font(None,25)
        texto_puntos = fuente.render("Puntos: "+str(heroe.puntos),1,(0,0,0))
        texto_vida = fuente.render("Vida: "+str(heroe.vida),1,(0,0,0))
        
        heroe.update()
        for n in villano:
            n.update()

        for n in villano:
            if heroe.rect.colliderect(n.rect) and n != m:
                m=n
                '''print 'colision nueva' '''
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                if heroe.vida > 0:
                    heroe.vida=heroe.vida-1
                n.velocidad=randint(1,10)
            elif heroe.rect.colliderect(n.rect) and n == m:
                heroe.image = heroe.imagenes[1]
                '''print 'colision antigua' '''
            elif heroe.rect.colliderect(n.rect) == False and n == m:
                m = None
                '''print 'sin colision' '''
        
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0,0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida,(400,450))
        screen.blit(texto_puntos,(100,450))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 13
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("Vuela, Pega y Esquiva")
    background_image = util.cargar_imagen('imagenes/fondo.jpg');
    pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
    pygame.mouse.set_visible(False)
    heroe = Carro()
    villano = [Roca((500,40), 4),
               Roca((700, 150), 4),
               Roca((500, 220), 4),
               Roca((800, 300), 4),
               Roca((600, 350), 4),
               Roca((500, 400), 4)]

    while True:
        fuente = pygame.font.Font(None, 25)
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1, (240, 240, 240))
        texto_vida = fuente.render("Daño: " + str(heroe.daño), 1, (240, 240, 240))
        heroe.update()
        for n in villano:
            n.update()

        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                if heroe.daño < 100:
                    heroe.daño = heroe.daño + 1
                    n.velocidad = 4
            elif heroe.rect.x == n.rect.x:
                heroe.puntos = heroe.puntos + 1
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (100, 410))
        screen.blit(texto_puntos, (100, 440))
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 14
0
def game():
      pygame.init()
      pygame.mixer.init()
      screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
      jugando = True
      pygame.display.set_caption( "Crossy Road" )
      fuente = pygame.font.Font(None, 30)
      background_image = util.cargar_imagen('imagenes/fondo.jpg');
      pierde_vida = util.cargar_sonido('sonidos/Pierde.wav')
      pygame.mouse.set_visible( False )
      temporizador = pygame.time.Clock()
      heroe = Heroe()
      heroe.leer_archivo()
      villano = [Villano((0,57),3),Villano((400,57),3), Villano((250,10),5),Villano((210,157),4),Villano((0,205),1),Villano((400,205),1), Villano((0,250),4),Villano((120,295),3),Villano((0,340),2),Villano((400,340),2),Villano((280,390),3)]
      while jugando:
          heroe.update()
          if heroe.vida <= 0:
              jugando = False
          texto_puntaje = fuente.render("Puntaje: " + str(heroe.puntaje), 1, (250, 250, 250))
          texto_puntajeMax= fuente.render("Record: " + str(heroe.puntaje_maximo) , 2, (250, 250, 250))
          for n in villano:
              n.update()
          heroe.image = heroe.imagen
          for n in villano:
              if heroe.rect.colliderect(n.rect):
                  pierde_vida.play()
                  heroe.vida -= 100
                  heroe.escribir_archivo()
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  sys.exit()
          screen.blit(background_image, (0,0))
          screen.blit(heroe.imagen, heroe.rect)
          for n in villano:
              screen.blit(n.image, n.rect)
          screen.blit(texto_puntaje, (20, 10))
          screen.blit(texto_puntajeMax, (300, 10))

          pygame.display.update()
          pygame.time.delay(20)
Ejemplo n.º 15
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    jugando = True
    pygame.display.set_caption("Crossy road")
    fuente = pygame.font.Font(None, 30)
    background_image = util.cargar_imagen('Imagenes/4.jpg')
    pierde_vida = util.cargar_sonido('Sonidos/el-pollo_1.mp3')
    gana_punt = util.cargar_sonido('Sonidos/misc108.mp3')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((0, 450), 6),
        Villano((0, 0), 6),
        Villano((50, 100), 4),
        Villano((100, 200), 10),
        Villano((150, 300), 8),
        Villano((200, 370), 20),
        Villano((200, 50), 20)
    ]
    hoguera = [
        Hoguera((100, 20), 0),
        Hoguera((125, 90), 0),
        Hoguera((310, 320), 0),
        Hoguera((100, 170), 0),
        Hoguera((400, 370), 0),
        Hoguera((170, 170), 0),
        Hoguera((250, 170), 0),
        Hoguera((200, 320), 0),
        Hoguera((350, 400), 0)
    ]
    maiz = [Maiz((310, 450), 0), Maiz((310, 0), 0)]
    while jugando:
        heroe.update()
        if heroe.vida <= 0:

            jugando = False
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1,
                                   (250, 250, 250))
        for n in villano:
            n.update()
        heroe.image = heroe.imagenes[0]
        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                heroe.vida -= 1
        for n in hoguera:

            n.update()
        heroe.image = heroe.imagenes[0]
        for n in hoguera:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                heroe.vida -= 1

        for n in maiz:
            if heroe.rect.colliderect(n.rect):
                gana_punt.play()
                heroe.punt += 0.5

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        for n in villano:
            screen.blit(n.image, n.rect)
        screen.blit(texto_vida, (20, 10))
        pygame.display.update()
        pygame.time.delay(10)
        for n in hoguera:
            screen.blit(n.image, n.rect)
        for n in maiz:
            screen.blit(n.image, n.rect)
        screen.blit(texto_vida, (20, 10))
        pygame.display.update()
        pygame.time.delay(10)
        texto_vida = fuente.render("Puntaje: " + str(heroe.punt), 1,
                                   (250, 250, 250))
        screen.blit(texto_vida, (400, 10))
        pygame.display.update()
        pygame.time.delay(10)
Ejemplo n.º 16
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
    pygame.display.set_caption( "El Cruce" )
    background_image = util.cargar_imagen('imagenes/carretera.jpg');
    pierde_vida = util.cargar_sonido('sonidos/bocina.wav')
    perder = util.cargar_sonido('sonidos/gritar.wav')
    pygame.mouse.set_visible( False )
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    teclas = pygame.key.get_pressed()
    villano = [Villano((0,130),randint(3,10)),
               Villano((0,210),randint(6,10)),
               Villano((0,290),randint(4,10)),
               Villano((0,370),randint(8,10)),
               Villano((0,450),randint(7,10)),
               Villano((0,530),randint(8,10)),
               Villano((0, 50),randint(3,10)),]
    
    while True:
        aviso  = pygame.font.Font(None,80)
        fuente = pygame.font.Font(None,35)
        texto_puntos = fuente.render("Puntos: "+str(heroe.puntos),1,(255,255,255))
        texto_vida = fuente.render("Vida: "+str(heroe.vida),1,(255,255,255))
        texto_final = aviso.render ("you're died",1,(255,0,0))
        texto_ganador = aviso.render ("Ganaste",1,(255,255,0))		
		
        
        heroe.update()
        for n in villano:
            n.update()   
				
        for n in villano:
            if heroe.rect.colliderect(n.rect):
                heroe.image = heroe.imagenes[1]
                pierde_vida.play()
                n.rect.y = 0
                n.velocidad = randint(8,15)
                if heroe.vida > 0:
                    heroe.vida=heroe.vida-1
                if heroe.puntos > 3:
                    heroe.puntos -= 3
            if n.rect.y > 585 and heroe.vida > 0:
				heroe.puntos += 1
				if heroe.puntos < 50:
					n.velocidad = randint(3,10)
				elif heroe.puntos < 100:
					n.velocidad = randint(8,15)
				elif heroe.puntos < 150:
					n.velocidad = randint(13,20)
				 
            elif heroe.vida == 0 or heroe.puntos == 150:
		            n.velocidad = 0 
		            n.rect.y = 10                      		
	    
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            if teclas[K_x]:
				sys.exit()
        
        screen.blit(background_image, (0,0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida,(400,550))
        screen.blit(texto_puntos,(100,550))
    	if heroe.vida == 0:		
			perder.play(1,(0)) #preguntar
			screen.blit(texto_final,(180,250))	
        if heroe.puntos == 150:
			screen.blit(texto_ganador,(180,250))
        
        for n in villano:
            screen.blit(n.image, n.rect)
        pygame.display.update()
        pygame.time.delay(5)
Ejemplo n.º 17
0
import pygame
import util

pygame.mixer.init()

boom = util.cargar_sonido('explosion.wav')

def reproducir_sonido(nombre):
    sonidos = {
            'boom': boom,
            }
    
    sonidos[nombre].play()
Ejemplo n.º 18
0
def main():
    pygame.init()
    pygame.mixer.init()

    fondo = pygame.image.load("imagenes/cocina.png")
    intro = pygame.image.load("imagenes/intro.png")
    fondorect = fondo.get_rect()
    introrect = intro.get_rect()

    pygame.display.set_caption("Chef Race (Universidad Distrital)")
    pizarra = pygame.image.load("imagenes/pizarra.png")
    sInicio = util.cargar_sonido('sonidos/inicio.wav')
    sHorno = util.cargar_sonido('sonidos/horno.wav')
    sCuchillo = util.cargar_sonido('sonidos/cuchillo.wav')
    sLicuadora = util.cargar_sonido('sonidos/licuadora.wav')
    sPrincipal = util.cargar_sonido('sonidos/principal.wav')

    chef1 = Chef((width - 900, height))
    chef2 = Chef((width - 700, height))
    chef3 = Chef((width - 500, height))
    pizarra1 = Pizarra((width - 900, height))
    pizarra2 = Pizarra((width - 700, height))
    pizarra3 = Pizarra((width - 500, height))
    receta1 = Receta((width, height))
    receta2 = Receta((width + 200, height))
    receta3 = Receta((width + 400, height))

    listaChefs = [chef1, chef2, chef3]
    listaPizarras = [pizarra1, pizarra2, pizarra3]
    listaRecetas = [receta1, receta2, receta3]
    cuchillos = Cuchillos(size)
    licuadora = Licuadora(size)
    horno = Horno(size)

    reloj = pygame.time.Clock()
    fuente1 = pygame.font.Font(None, 70)
    fuente2 = pygame.font.Font(None, 25)
    textoBienvenida = fuente1.render("Bienvenido a Chef Race UD", 1,
                                     (255, 255, 255))
    textoAutor1 = fuente2.render("Marlon Arias", 1, (0, 0, 0))
    textoAutor2 = fuente2.render("David Amado", 1, (0, 0, 0))
    textoAutor3 = fuente2.render("Realizado por:", 1, (0, 0, 0))

    sInicio.play()
    aux = 3

    while aux > 0:
        screen.blit(intro, introrect)
        screen.blit(textoAutor1, (width - 170, height - 680))
        screen.blit(textoAutor2, (width - 170, height - 660))
        screen.blit(textoAutor3, (width - 170, height - 700))
        screen.blit(textoBienvenida, ((width - 880, (height / 2) + 30)))
        pygame.display.update()
        time.sleep(1)
        aux = aux - 1

    sPrincipal.play(1)

    while 1:
        reloj.tick(30)

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

            if event.type == pygame.MOUSEBUTTONDOWN:
                for x in range(810, 881):
                    for y in range(137, 257):
                        if event.button == 1 and event.pos == (x, y):
                            chef1.estado = "trabajandoLicuadora1"
                            sLicuadora.play()
                            licuadora.rect.move_ip(-700, +70)
                        elif event.button == 2 and event.pos == (x, y):
                            chef2.estado = "trabajandoLicuadora1"
                            sLicuadora.play()
                            licuadora.rect.move_ip(-505, +70)
                        elif event.button == 3 and event.pos == (x, y):
                            chef3.estado = "trabajandoLicuadora1"
                            sLicuadora.play()
                            licuadora.rect.move_ip(-305, +70)

                for x in range(770, 890):
                    for y in range(282, 402):
                        if event.button == 1 and event.pos == (x, y):
                            chef1.estado = "trabajandoHorno1"
                            sHorno.play()
                            horno.rect.move_ip(-690, +45)
                        elif event.button == 2 and event.pos == (x, y):
                            chef2.estado = "trabajandoHorno1"
                            sHorno.play()
                            horno.rect.move_ip(-490, +45)
                        elif event.button == 3 and event.pos == (x, y):
                            chef3.estado = "trabajandoHorno1"
                            sHorno.play()
                            horno.rect.move_ip(-290, +45)

                for x in range(780, 900):
                    for y in range(27, 125):
                        if event.button == 1 and event.pos == (x, y):
                            chef1.estado = "trabajandoCuchillo1"
                            sCuchillo.play()
                            cuchillos.rect.move_ip(-700, +95)
                        elif event.button == 2 and event.pos == (x, y):
                            chef2.estado = "trabajandoCuchillo1"
                            sCuchillo.play()
                            cuchillos.rect.move_ip(-500, +95)
                        elif event.button == 3 and event.pos == (x, y):
                            chef3.estado = "trabajandoCuchillo1"
                            sCuchillo.play()
                            cuchillos.rect.move_ip(-300, +95)

        for elemento in listaChefs:
            elemento.update()

        time.sleep(0.5)
        screen.blit(fondo, fondorect)

        for elemento in listaChefs:
            screen.blit(elemento.image, elemento.rect)

        for elemento in listaPizarras:
            screen.blit(elemento.image, elemento.rect)

        for elemento in listaRecetas:
            screen.blit(elemento.image, elemento.rect)

        screen.blit(cuchillos.image, cuchillos.rect)
        screen.blit(licuadora.image, licuadora.rect)
        screen.blit(horno.image, horno.rect)

        pygame.display.update()
Ejemplo n.º 19
0
def game():
    pygame.init()
    pygame.mixer.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("El Cruce")
    background_image = util.cargar_imagen('imagenes/fondo.jpg')
    pierde_vida = util.cargar_sonido('sonidos/pierde_vida.wav')
    pygame.mouse.set_visible(False)
    temporizador = pygame.time.Clock()
    heroe = Heroe()
    villano = [
        Villano((100, 80), randint(1, 10)),
        Villano((100, 150), randint(1, 10)),
        Villano((200, 220), randint(1, 10)),
        Villano((300, 300), randint(1, 10)),
        Villano((100, 350), randint(1, 10))
    ]
    bonos = [
        Bono((randint(50, 600), 80), 0),
        Bono((randint(50, 600), 150), 0),
        Bono((randint(50, 600), 220), 0),
        Bono((randint(50, 600), 300), 0),
        Bono((randint(50, 600), 350), 0)
    ]
    bonosInmunes = [
        BonoInmune((randint(50, 600), randint(50, 400)), 0),
        BonoInmune((randint(50, 600), randint(50, 400)), 0)
    ]
    m = villano[1]
    tinicio = pygame.time.get_ticks()
    while True:
        fuente = pygame.font.Font(None, 25)
        texto_puntos = fuente.render("Puntos: " + str(heroe.puntos), 1,
                                     (0, 0, 0))
        texto_tiempo = fuente.render("Tiempo: 0", 1, (0, 0, 0))
        if heroe.estado == "inmune":
            texto_tiempo = fuente.render(
                "Tiempo: " + str(pygame.time.get_ticks() - tinicio), 1,
                (0, 0, 0))
        texto_vida = fuente.render("Vida: " + str(heroe.vida), 1, (0, 0, 0))

        heroe.update()
        for n in villano:
            n.update()

        for b in bonos:
            b.update()

        for bi in bonosInmunes:
            bi.update()

        for n in villano:
            if heroe.rect.colliderect(n.rect) and n != m:
                m = n
                if heroe.estado != "inmune":
                    heroe.image = heroe.imagenes[1]
                    pierde_vida.play()
                    if heroe.vida > 0:
                        heroe.vida = heroe.vida - 1
                        n.velocidad = randint(1, 10)
                else:
                    villano.remove(n)
            elif heroe.rect.colliderect(n.rect) and n == m:
                if heroe.estado != "inmune":
                    heroe.image = heroe.imagenes[1]
                else:
                    villano.remove(n)
                '''print 'colision antigua' '''
            elif heroe.rect.colliderect(n.rect) == False and n == m:
                m = None
                '''print 'sin colision' '''

        for b in bonos:
            if heroe.rect.colliderect(b.rect):
                if heroe.estado != "inmune":
                    heroe.image = heroe.imagenes[1]
                    if heroe.vida < 100:
                        heroe.vida = heroe.vida + 2
                        bonos.remove(b)

        for bi in bonosInmunes:
            if heroe.rect.colliderect(bi.rect) and heroe.estado != "inmune":
                heroe.actInmunidad()
                heroe.image = heroe.imagenes[4]
                heroe.vida = 100
                tinicio = pygame.time.get_ticks()
                bonosInmunes.remove(bi)

        if heroe.estado == "inmune":
            if (pygame.time.get_ticks() - tinicio) >= 60000:
                heroe.estado = "bajando"
                heroe.image = heroe.imagenes[4]
        if len(villano) < 5 and heroe.estado != "inmune":
            for n in villano:
                villano.remove(n)
            villano = [
                Villano((100, 80), randint(1, 10)),
                Villano((100, 150), randint(1, 10)),
                Villano((200, 220), randint(1, 10)),
                Villano((300, 300), randint(1, 10)),
                Villano((100, 350), randint(1, 10))
            ]

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.blit(background_image, (0, 0))
        screen.blit(heroe.image, heroe.rect)
        screen.blit(texto_vida, (400, 450))
        screen.blit(texto_tiempo, (250, 450))
        screen.blit(texto_puntos, (100, 450))
        for n in villano:
            screen.blit(n.image, n.rect)
        for b in bonos:
            screen.blit(b.image, b.rect)
        for bi in bonosInmunes:
            screen.blit(bi.image, bi.rect)
        pygame.display.update()
        pygame.time.delay(10)