62 lines
2.0 KiB
Python
62 lines
2.0 KiB
Python
import pygame
|
|
import sys
|
|
import button
|
|
import random
|
|
|
|
def main():
|
|
pygame.init()
|
|
|
|
screen = pygame.display.set_mode((1000,700))
|
|
pygame.display.set_caption("Space game")
|
|
icon = pygame.image.load("ICON.png")
|
|
pygame.display.set_icon(icon)
|
|
background = pygame.image.load("space.jpg")
|
|
background = pygame.transform.scale(background, (1000,700))
|
|
|
|
hangar = pygame.image.load("HANGAR.jpg")
|
|
|
|
#text
|
|
font = pygame.font.Font("KodeMono-Medium.ttf", 32)
|
|
smaller_font = pygame.font.Font("KodeMono-Medium.ttf", 24)
|
|
over_font = pygame.font.Font("KodeMono-Medium.ttf", 96)
|
|
|
|
text_color = (255, 255, 255)
|
|
|
|
#button
|
|
new_game_img = pygame.image.load("new_game.png")
|
|
difficulty_img = pygame.image.load("difficulty.png")
|
|
difficulty_easy_img = pygame.image.load("difficulty_easy.png")
|
|
difficulty_medium_img = pygame.image.load("difficulty_medium.png")
|
|
difficulty_hard_img = pygame.image.load("difficulty_hard.png")
|
|
difficulty_insane_img = pygame.image.load("difficulty_insane.png")
|
|
best_score_img = pygame.image.load("best_score.png")
|
|
back_img = pygame.image.load("back.png")
|
|
|
|
new_game_button = button.Button(400, 320, new_game_img, 1)
|
|
difficulty_button = button.Button(400, 410, difficulty_img, 1)
|
|
best_score_button = button.Button(400, 500, best_score_img, 1)
|
|
back_button = button.Button(400, 580, back_img, 1)
|
|
difficulty_buttons = [
|
|
button.Button(290, 150, difficulty_easy_img, 1),
|
|
button.Button(510, 150, difficulty_medium_img, 1),
|
|
button.Button(290, 250, difficulty_hard_img, 1),
|
|
button.Button(510, 250, difficulty_insane_img, 1)
|
|
]
|
|
scene = "menu"
|
|
game_paused = False
|
|
game_lost = False
|
|
|
|
running = True
|
|
|
|
difficulty = 0
|
|
|
|
|
|
while running:
|
|
for event in pygame.event.get():
|
|
if event.type == pygame.QUIT:
|
|
running = False
|
|
|
|
|
|
screen.blit(background, (0, 0))
|
|
|
|
pygame.display.flip() |