import pygame
import random
import sys
# Inicializar pygame
pygame.init()
# Configuración de la ventana a pantalla completa
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
# Obtener el tamaño de la pantalla
width, height = pygame.display.get_surface().get_size()
# Fuente y tamaño de los caracteres
font = pygame.font.Font(None, 36)
# Colores
green = (0, 255, 0)
black = (0, 0, 0)
# Lista de caracteres y sus posiciones
characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=[]{}|;:'\",.<>?/\\~`"
columns = range(0, width, 20)
matrix = [[random.choice(characters) for _ in range(height // 20)] for _ in columns]
# Velocidad de caída
fall_speed = 2
# Bucle principal
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill(black)
for x, column in enumerate(matrix):
for y, char in enumerate(column):
text = font.render(char, True, green)
screen.blit(text, (x * 20, y * 20))
for x in range(len(matrix)):
if random.random() < 0.1:
matrix[x].insert(0, random.choice(characters))
if len(matrix[x]) * 20 > height:
matrix[x].pop()
pygame.display.flip()
pygame.time.delay(fall_speed)
# Salir del programa
pygame.quit()
sys.exit()
Comentarios sobre la versión: 1.0 (0)
No hay comentarios