import pygame
import numpy as np
import random
# Initialize Pygame
pygame.init()
# Set up display variables
WIDTH, HEIGHT = 800, 600
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
FONT_SIZE = 24
FONT = pygame.font.SysFont("Arial", FONT_SIZE)
class Particle:
def __init__(self, x, y, color, size):
self.x = x
self.y = y
self.color = color
self.size = size
self.velocity_x = random.uniform(-1, 1)
self.velocity_y = random.uniform(-1, 1)
def update(self):
self.x += self.velocity_x
self.y += self.velocity_y
if self.x < 0 or self.x > WIDTH:
self.velocity_x *= -1
if self.y < 0 or self.y > HEIGHT:
self.velocity_y *= -1
def draw(self, screen):
pygame.draw.circle(screen, self.color, (int(self.x), int(self.y)), self.size)
class Story:
def __init__(self):
self.sentences = [
"In a world where time was currency, the rich lived forever.",
"The poor, on the other hand, were left with nothing but the fleeting moments of their lives.",
"A young girl named Aria lived in a small village on the outskirts of the city.",
"She had always been fascinated by the clockwork mechanisms that governed the flow of time.",
"One day, she stumbled upon a hidden underground market where time was bought and sold like a commodity.",
"The market was run by a mysterious figure known only as the Timekeeper.",
"Aria was drawn to the Timekeeper's enigmatic presence and decided to learn more about the art of time manipulation.",
"As she delved deeper into the world of time trading, Aria discovered a dark secret: the rich were not only living forever, but they were also stealing time from the poor.",
"Determined to put an end to this injustice, Aria joined a group of rebels fighting against the Timekeeper's regime.",
"Together, they hatched a plan to infiltrate the Timekeeper's fortress and steal the source of their power: the Chronos Crystal.",
"The night of the heist, Aria and her team snuck into the fortress, avoiding the Timekeeper's guards and traps.",
"As they reached the heart of the fortress, they found the Chronos Crystal: a glowing orb that pulsed with the rhythm of time.",
"But, to their surprise, the Timekeeper was waiting for them, and a fierce battle ensued.",
"Aria and her team fought bravely, but they were no match for the Timekeeper's mastery of time manipulation.",
"Just as all hope seemed lost, Aria remembered the words of an old wise man: 'Time is not a currency, but a gift.'",
"With newfound determination, Aria used her knowledge of clockwork mechanisms to create a device that could harness the power of the Chronos Crystal.",
"The device, known as the Time Reverter, had the ability to rewind time and restore balance to the world.",
"Aria and her team used the Time Reverter to turn back the clock, erasing the injustices of the past and creating a new future.",
"The rich were no longer immortal, and the poor were given a second chance at life.",
"Aria, now a hero, was hailed by the people, and her name became synonymous with bravery and wisdom.",
"And so, the world was reborn, with time no longer a currency, but a gift to be cherished and respected."
]
def display_sentence(self, screen, sentence, particles):
text = FONT.render(sentence, True, WHITE)
screen.blit(text, (WIDTH // 2 - text.get_width() // 2, FONT_SIZE))
pygame.display.update()
pygame.time.delay(2000)
for particle in particles:
particle.update()
particle.draw(screen)
pygame.display.update()
pygame.time.delay(1000)
def main():
screen = pygame.display.set_mode((WIDTH, HEIGHT))
clock = pygame.time.Clock()
story = Story()
particles = [Particle(random.randint(0, WIDTH), random.randint(0, HEIGHT), (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)), random.randint(2, 5)) for _ in range(100)]
for sentence in story.sentences:
screen.fill(BLACK)
story.display_sentence(screen, sentence, particles)
pygame.quit()
if __name__ == "__main__":
main()