Skip to content

Reaching Your Moon and Beyond

Published: at 03:28 AM

Reach for the stars. Dream big, aim high. Your journey begins now. Take that first step. Leave behind the naysayers. Shed the weight of doubt. Your rocket awaits you.

Fuel it with determination. Ignite your passion’s flame. The countdown has started. Three, two, one, liftoff! Feel the rumble beneath. Your heart races, pounding. Soaring through the atmosphere, you break free from Earth’s gravity.

The journey is long. Days blend into nights. You face unexpected challenges. Meteors of doubt threaten. Cosmic rays of fear bombard. But you persist, unwavering.

Look back at Earth. See how far you’ve come. Those who doubted you are mere specks now. Their voices can’t reach you here. You’ve outgrown their limitations.

The moon grows larger. Its cratered face beckons. You’ve come so far, but the final stretch looms. Fatigue sets in. Doubts creep back. But remember why you started. Remember the fire that burns within.

Your craft touches down. You’ve arrived. Step out onto the lunar surface. Plant your flag of achievement. Look up at the Earth, a blue marble suspended in the void. You’ve done it. You’ve reached your moon.

But this isn’t the end. It’s a new beginning. New horizons await. Mars glows red in the distance. The journey continues. Your ambition knows no bounds. Keep reaching, keep growing. The universe is yours to explore.

import pygame
import sys
import random
import math

pygame.init()

WIDTH, HEIGHT = 800, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Journey to the Moon and Beyond")

# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
LIGHT_BLUE = (173, 216, 230)
GRAY = (169, 169, 169)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
GREEN = (34, 139, 34)
DARK_GREEN = (0, 100, 0)

clock = pygame.time.Clock()

font = pygame.font.Font(None, 24)
rocket_font = pygame.font.Font(None, 18)


class Rocket:
    def __init__(self):
        self.width = 30
        self.height = 60
        self.reset()

    def reset(self):
        self.x = WIDTH // 2
        self.y = HEIGHT - self.height - 20
        self.velocity_y = 0
        self.acceleration = 0.01
        self.fuel = 100
        self.landed = False

    def update(self):
        if not self.landed:
            if self.fuel > 0:
                self.velocity_y -= self.acceleration
                self.fuel -= 0.1
            else:
                self.velocity_y += 0.005
            self.y += self.velocity_y

    def land(self, moon_y):
        if not self.landed and abs(self.y - moon_y) < 5:
            self.y = moon_y
            self.velocity_y = 0
            self.landed = True

    def draw(self, surface):
        pygame.draw.rect(surface, WHITE, (self.x - self.width //
                         2, self.y, self.width, self.height))

        pygame.draw.polygon(surface, RED, [
            (self.x - self.width // 2, self.y),
            (self.x, self.y - 20),
            (self.x + self.width // 2, self.y)
        ])

        pygame.draw.polygon(surface, RED, [
            (self.x - self.width // 2, self.y + self.height),
            (self.x - self.width // 2 - 10, self.y + self.height + 15),
            (self.x - self.width // 2, self.y + self.height - 10)
        ])
        pygame.draw.polygon(surface, RED, [
            (self.x + self.width // 2, self.y + self.height),
            (self.x + self.width // 2 + 10, self.y + self.height + 15),
            (self.x + self.width // 2, self.y + self.height - 10)
        ])

        for i, letter in enumerate("MARK"):
            letter_surface = rocket_font.render(letter, True, BLACK)
            letter_rect = letter_surface.get_rect(
                center=(self.x, self.y + 15 + i * 12))
            surface.blit(letter_surface, letter_rect)

        if self.fuel > 0 and not self.landed:
            exhaust_length = random.randint(10, 30)
            pygame.draw.polygon(surface, YELLOW, [
                (self.x - 5, self.y + self.height),
                (self.x + 5, self.y + self.height),
                (self.x, self.y + self.height + exhaust_length)
            ])


class CelestialBody:
    def __init__(self, x, y, radius, color):
        self.x = x
        self.y = y
        self.radius = radius
        self.color = color

    def draw(self, surface):
        pygame.draw.circle(surface, self.color,
                           (int(self.x), int(self.y)), self.radius)


class Earth(CelestialBody):
    def draw(self, surface):
        super().draw(surface)

        pygame.draw.arc(surface, WHITE, (self.x - self.radius, self.y - self.radius,
                        self.radius * 2, self.radius * 0.5), math.pi, 2*math.pi, 10)

        pygame.draw.polygon(surface, GREEN, [
            (self.x - self.radius * 0.4, self.y - self.radius * 0.7),
            (self.x - self.radius * 0.2, self.y - self.radius * 0.9),
            (self.x, self.y - self.radius * 0.8),
            (self.x, self.y - self.radius * 0.6),
            (self.x - self.radius * 0.3, self.y - self.radius * 0.5)
        ])

        pygame.draw.polygon(surface, DARK_GREEN, [
            (self.x + self.radius * 0.1, self.y - self.radius * 0.8),
            (self.x + self.radius * 0.4, self.y - self.radius * 0.9),
            (self.x + self.radius * 0.5, self.y - self.radius * 0.7),
            (self.x + self.radius * 0.3, self.y - self.radius * 0.5),
            (self.x, self.y - self.radius * 0.6)
        ])

        pygame.draw.circle(surface, GREEN, (int(self.x - self.radius * 0.5),
                           int(self.y - self.radius * 0.8)), int(self.radius * 0.05))
        pygame.draw.circle(surface, DARK_GREEN, (int(
            self.x + self.radius * 0.6), int(self.y - self.radius * 0.75)), int(self.radius * 0.07))

        glow_surf = pygame.Surface(
            (self.radius * 2.2, self.radius * 2.2), pygame.SRCALPHA)
        pygame.draw.circle(glow_surf, (173, 216, 230, 100), (int(
            self.radius * 1.1), int(self.radius * 1.1)), int(self.radius * 1.1))
        surface.blit(glow_surf, (self.x - self.radius * 1.1, self.y -
                     self.radius * 1.1), special_flags=pygame.BLEND_ALPHA_SDL2)


class Star:
    def __init__(self):
        self.x = random.randint(0, WIDTH)
        self.y = random.randint(0, HEIGHT)
        self.size = random.randint(1, 2)
        self.brightness = random.randint(100, 255)
        self.twinkle_speed = random.uniform(0.02, 0.05)

    def update(self):
        self.brightness += math.sin(pygame.time.get_ticks()
                                    * self.twinkle_speed) * 5
        self.brightness = max(100, min(255, self.brightness))

    def draw(self, surface):
        pygame.draw.circle(surface, (self.brightness, self.brightness,
                           self.brightness), (int(self.x), int(self.y)), self.size)


def draw_stars(surface, stars):
    for star in stars:
        star.update()
        star.draw(surface)


def display_message(surface, message, y_offset=0):
    text = font.render(message, True, WHITE)
    text_rect = text.get_rect(center=(WIDTH // 2, HEIGHT - 40 + y_offset))
    surface.blit(text, text_rect)


def main():
    rocket = Rocket()
    earth = Earth(WIDTH // 2, HEIGHT + 300, 400, BLUE)
    moon = CelestialBody(WIDTH // 2, 100, 50, GRAY)
    mars = CelestialBody(WIDTH - 50, 50, 30, RED)
    stars = [Star() for _ in range(200)]

    messages = [
        "Your rocket awaits. Press SPACE to begin your journey.",
        "Liftoff! Feel the rumble as you soar through the atmosphere.",
        "Breaking free from Earth's gravity. The journey is long.",
        "Look back at Earth. See how far you've come.",
        "The moon grows larger. The final stretch looms.",
        "Touching down on the lunar surface. You've done it!",
        "Plant your flag of achievement. But this isn't the end.",
        "New horizons await. Mars glows red in the distance.",
        "The journey continues. The universe is yours to explore.",
        "Press SPACE to restart the journey."
    ]

    def reset_game():
        nonlocal launch_phase, current_message, message_timer
        rocket.reset()
        launch_phase = 0
        current_message = 0
        message_timer = 0

    launch_phase = 0
    current_message = 0
    message_timer = 0
    message_delay = 3000

    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
                    if launch_phase == 0 or current_message == len(messages) - 1:
                        reset_game()
                        launch_phase = 1
                        current_message = 1

        screen.fill(BLACK)
        draw_stars(screen, stars)
        moon.draw(screen)
        earth.draw(screen)
        mars.draw(screen)

        if launch_phase > 0:
            rocket.update()
            distance_to_moon = math.hypot(
                rocket.x - moon.x, rocket.y - (moon.y + moon.radius))

            if distance_to_moon < 60 and not rocket.landed:
                current_message = 4
            if distance_to_moon < 5:
                rocket.land(moon.y + moon.radius)
                if rocket.landed and current_message < 5:
                    current_message = 5
                    message_timer = pygame.time.get_ticks()
            elif rocket.fuel <= 0:
                current_message = 3
            elif rocket.y < HEIGHT // 2:
                current_message = 2

        rocket.draw(screen)
        display_message(screen, messages[current_message])

        if rocket.landed:
            current_time = pygame.time.get_ticks()
            if current_time - message_timer > message_delay:
                if current_message < len(messages) - 1:
                    current_message += 1
                    message_timer = current_time

        pygame.display.flip()
        clock.tick(60)

    pygame.quit()
    sys.exit()


if __name__ == "__main__":
    main()