Upload files to "/"
parent
cc90e6b467
commit
7e7d0566e8
28
main.py
28
main.py
|
@ -11,7 +11,7 @@ def main():
|
||||||
icon = pygame.image.load("ICON.png")
|
icon = pygame.image.load("ICON.png")
|
||||||
pygame.display.set_icon(icon)
|
pygame.display.set_icon(icon)
|
||||||
background = pygame.image.load("space.jpg")
|
background = pygame.image.load("space.jpg")
|
||||||
background = pygame.transform.scale(background, (1000,700))
|
# background = pygame.transform.scale(background, (1000,700))
|
||||||
|
|
||||||
hangar = pygame.image.load("HANGAR.jpg")
|
hangar = pygame.image.load("HANGAR.jpg")
|
||||||
|
|
||||||
|
@ -50,8 +50,34 @@ def main():
|
||||||
|
|
||||||
difficulty = 0
|
difficulty = 0
|
||||||
|
|
||||||
|
def draw_text(text, font, text_col, x, y):
|
||||||
|
text = font.render(text, True, text_col)
|
||||||
|
screen.blit(text, (x, y))
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
|
match scene:
|
||||||
|
case "menu":
|
||||||
|
screen.blit(hangar, (0, 0)) #menu
|
||||||
|
if new_game_button.draw(screen):
|
||||||
|
scene = "game"
|
||||||
|
if difficulty_button.draw(screen):
|
||||||
|
scene = "difficulty"
|
||||||
|
if best_score_button.draw(screen):
|
||||||
|
scene = "best_score"
|
||||||
|
case "best_score":
|
||||||
|
screen.blit(hangar, (0, 0))
|
||||||
|
print_best_score(best_score[difficulty])
|
||||||
|
if back_button.draw(screen):
|
||||||
|
scene = "menu"
|
||||||
|
case "difficulty":
|
||||||
|
screen.blit(hangar, (0, 0))
|
||||||
|
draw_text("Choose the difficulty", font, text_color, 350, 50)
|
||||||
|
for i in range(0, len(difficulty_buttons)):
|
||||||
|
if difficulty_buttons[i].draw(screen):
|
||||||
|
difficulty = i
|
||||||
|
scene = "menu"
|
||||||
|
if back_button.draw(screen):
|
||||||
|
scene = "menu"
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
running = False
|
running = False
|
||||||
|
|
Loading…
Reference in New Issue