Mam nadzieję że się wam podoba ...
- import pygame
- import random
- # Inicjalizacja Pygame
- pygame.init()
- # Ustawienie rozmiaru ekranu
- screen_width = 800
- screen_height = 600
- screen = pygame.display.set_mode((screen_width, screen_height))
- # Ustawienie tła
- background_color = (0, 0, 0)
- screen.fill(background_color)
- # Utworzenie gwiazd
- num_stars = 80
- stars = []
- for i in range(num_stars):
- x = random.randint(0, screen_width)
- y = random.randint(0, screen_height)
- size = random.randint(1, 3)
- stars.append((x, y, size))
- # Utworzenie obiektu czcionki
- font = pygame.font.SysFont("comicsansms", 72)
- # Utworzenie listy kolorów dla napisu tęczowego
- rainbow_colors = [(255, 0, 0), (255, 165, 0), (255, 255, 0),
- (0, 128, 0), (0, 0, 255), (75, 0, 130), (238, 130, 238)]
- # Utworzenie napisu
- text = font.render("Lothar TeaM", True, rainbow_colors[0])
- # Pozycjonowanie napisu na środku ekranu
- text_rect = text.get_rect()
- text_rect.center = (screen_width // 2, screen_height // 2)
- # Pętla animacji
- while True:
- # Obsługa zdarzeń
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- quit()
- # Aktualizacja koloru tekstu
- current_color = rainbow_colors.pop(0)
- rainbow_colors.append(current_color)
- text = font.render("Lothar TeaM", True, current_color)
- # Aktualizacja pozycji gwiazd
- for i in range(num_stars):
- x, y, size = stars[i]
- x -= size/2
- if x < 0:
- x = screen_width
- y = random.randint(0, screen_height)
- stars[i] = (x, y, size)
- # Rysowanie gwiazd
- screen.fill(background_color)
- for x, y, size in stars:
- color = (255, 255, 255)
- pygame.draw.circle(screen, color, (x, y), size)
- # Rysowanie napisu
- screen.blit(text, text_rect)
- # Wyświetlenie zmian na ekranie
- pygame.display.update()
- # Opóźnienie między kolejnymi klatkami animacji
- pygame.time.delay(20)