Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
1
Indexable
Never
import pygame
import sys

# Initialize Pygame
pygame.init()

# Set dimensions
width, height = 400, 400

# Set colors
white = (255, 255, 255)
brown = (139, 69, 19)

# Create Pygame window
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("3D Acorn")

# Set acorn dimensions
acorn_width, acorn_height, acorn_length = 200, 200, 200

# Main loop
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    # Draw acorn
    pygame.draw.rect(screen, brown, (width/2 - acorn_width/2, height/2 - acorn_height/2, acorn_width, acorn_height))  # Acorn body
    pygame.draw.polygon(screen, brown, [(width/2, height/2 - acorn_height/2), 
                                        (width/2 - acorn_width/2, height/2), 
                                        (width/2 + acorn_width/2, height/2)])  # Acorn cap
    pygame.font.init()
    font = pygame.font.Font(None, 36)
    text = font.render("Acorn Hill #1", True, white)
    screen.blit(text, (width/2 - text.get_width()/2, height/2 - text.get_height()/2))

    # Update display
    pygame.display.flip()
Leave a Comment