def __init__(self, puntos): "Inicializar Escena de Juego Terminado." Escena.__init__(self) self.fondo = cargar_imagen("terminado.jpg") self.instrucciones = Multilinea(("Reiniciar [F5]", "Salir [Esc]")) self.instrucciones.pos(2, 2, 16, 16) self.terminado = Texto("Juego Terminado", tamano=72) self.puntos = Texto("Puntos: " + str(puntos), tamano=48)
def __init__(self): Escena.__init__(self) #Creacion de objetos del videojuego. self.serpiente = Serpiente() self.comida = Comida(self.serpiente) #Variables de control. self.puntos = 0 self.termino = False #Textos. self.puntuacion = Texto("Puntos: ")
def __init__(self): "Inicializa el videojuego." p.init() self.pantalla = p.display.set_mode(PANTALLA) p.display.set_caption("Unbound Snake") #Creacion de objetos del videojuego. self.serpiente = Serpiente() self.comida = Comida(self.serpiente) #Variables de control. self.puntos = 0 self.termino = False #Textos. self.puntuacion = Texto("Puntos: ") self.instrucciones = Multilinea(("Reiniciar [F5]", "Salir [Esc]")) self.instrucciones.pos(2, 2, 16, 16)
def dibujar(self): "Muestra los objetos en pantalla." self.pantalla.fill((0x11, 0x11, 0x11)) #Dibujar objetos en la interfaz. self.pantalla.blit(self.comida.image, self.comida.mostrar()) self.pantalla.blit(self.puntuacion.mostrar(str(self.puntos)), self.puntuacion.pos(horz=0, vert=0)) #Dibujar la serpiente. for i in range(0, len(self.serpiente.cuerpo)): self.pantalla.blit(self.serpiente.image, self.serpiente.cuerpo[i]) #Juego Terminado if self.termino: self.instrucciones.mostrar(self.pantalla, 2) terminado = Texto("Juego Terminado", tamano=72) self.pantalla.blit(terminado.mostrar(), terminado.pos(1, 1)) p.display.flip()
def __init__(self): Escena.__init__(self) self.fondo = cargar_imagen("titulo.jpg") self.txt_salir = Texto("[ESC] Salir", 48) self.txt_salir.pos(2, 2) self.txt_jugar = Texto("[F5] Jugar", 48)