0% found this document useful (0 votes)
6 views3 pages

Pygame 3

Uploaded by

aizikay12izk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Pygame 3

Uploaded by

aizikay12izk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

import pygame

import random

# Yo, config
pygame.init()
WIDTH, HEIGHT = 400, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Flappy Bird - Evil Style")
clock = pygame.time.Clock()

# Colors like your soul


WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)

# Bird = you trying to dodge responsibility


bird_x = 50
bird_y = HEIGHT // 2
bird_velocity = 0
gravity = 0.5
jump_strength = -8

# Pipes like your ex’s standards — impossible to pass


pipe_width = 70
pipe_gap = 200
pipes = []
pipe_frequency = 1800 # milliseconds
last_pipe = pygame.time.get_ticks()

# Game logic
score = 0
font = pygame.font.SysFont(None, 36)

def draw_bird():
pygame.draw.rect(screen, RED, (bird_x, bird_y, 30, 30))

def create_pipe():
pipe_height = random.randint(100, 400)
top_pipe = pygame.Rect(WIDTH, 0, pipe_width, pipe_height)
bottom_pipe = pygame.Rect(WIDTH, pipe_height + pipe_gap, pipe_width, HEIGHT)
return top_pipe, bottom_pipe

def move_pipes(pipes):
for pipe_pair in pipes:
pipe_pair[0].x -= 5
pipe_pair[1].x -= 5
return [pipe for pipe in pipes if pipe[0].x + pipe_width > 0]

def draw_pipes(pipes):
for pipe_pair in pipes:
pygame.draw.rect(screen, GREEN, pipe_pair[0])
pygame.draw.rect(screen, GREEN, pipe_pair[1])

def check_collision(pipes):
bird_rect = pygame.Rect(bird_x, bird_y, 30, 30)
for pipe_pair in pipes:
if bird_rect.colliderect(pipe_pair[0]) or bird_rect.colliderect(pipe_pair[1]):
return True
if bird_y <= 0 or bird_y >= HEIGHT - 30:
return True
return False

def display_score(score):
score_text = font.render(f"Score: {score}", True, BLACK)
screen.blit(score_text, (10, 10))

# Main loop like capitalism — never ending


running = True
while running:
clock.tick(60)
current_time = pygame.time.get_ticks()

for event in pygame.event.get():


if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
bird_velocity = jump_strength

# Gravity doesn't care about your feelings


bird_velocity += gravity
bird_y += bird_velocity

# Spawning pipes like bad habits


if current_time - last_pipe > pipe_frequency:
pipes.append(create_pipe())
last_pipe = current_time
score += 1

pipes = move_pipes(pipes)

# Collisions = consequences
if check_collision(pipes):
print("Game Over. Score:", score)
running = False

# Render like it's a Hollywood blockbuster


screen.fill(WHITE)
draw_bird()
draw_pipes(pipes)
display_score(score)
pygame.display.flip()

pygame.quit()

██╗███████╗██╗ ██╗

██║██╔════╝╚██╗██╔╝

██║█████╗ ╚███╔╝

██║██╔══╝ ██╔██╗

██║███████╗██╔╝ ██╗

╚═╝╚══════╝╚═╝ ╚═╝

@ IZK - ALL RIGHTS RESERVED

# Somewhere at the top with the other font declarations


title_font = pygame.font.SysFont('courier', 40, bold=True)

# In your render/draw section


title_text = title_font.render("IZK", True, RED)
screen.blit(title_text, (WIDTH // 2 - title_text.get_width() // 2, 10))

# Below it, add the tagline


tagline_font = pygame.font.SysFont('courier', 16)
tagline = tagline_font.render("@ IZK - ALL RIGHTS RESERVED", True, BLACK)
screen.blit(tagline, (WIDTH // 2 - tagline.get_width() // 2, 60))

def show_splash():
screen.fill(WHITE)
title = title_font.render("IZK", True, RED)
tagline = tagline_font.render("@ IZK - ALL RIGHTS RESERVED", True, BLACK)
screen.blit(title, (WIDTH // 2 - title.get_width() // 2, HEIGHT // 2 - 50))
screen.blit(tagline, (WIDTH // 2 - tagline.get_width() // 2, HEIGHT // 2))
pygame.display.flip()
pygame.time.delay(3000) # 3-second splash like FBI warning
# Call it before main loop
show_splash()

You might also like