Update menu copy 2.py
parent
13e6d6777b
commit
ebeef03971
|
@ -1,37 +1,53 @@
|
|||
import pygame, sys
|
||||
from button import Button
|
||||
import pygame
|
||||
import sys
|
||||
from button import Button # Assuming you have a Button class defined in a separate file
|
||||
from random import randint
|
||||
import math
|
||||
|
||||
pygame.init()
|
||||
|
||||
SCREEN = pygame.display.set_mode((1280, 720))
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
SCREEN = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
pygame.display.set_caption("Rouglite")
|
||||
|
||||
# Loading images and music
|
||||
BG = pygame.image.load("assets/Background.png")
|
||||
LD = pygame.transform.scale(pygame.image.load("Sprites/loading.png").convert(), (SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
|
||||
pygame.mixer.music.load('assets/Pixel 7.mp3')
|
||||
|
||||
|
||||
# Воспроизведение музыки
|
||||
pygame.mixer.music.play()
|
||||
|
||||
# Добавьте какую-то задержку, чтобы музыка воспроизводилась в течение некоторого времени
|
||||
pygame.time.delay(5000) # Например, 5000 миллисекунд (5 секунд)
|
||||
|
||||
# Define fonts
|
||||
def get_font(size): # Returns Press-Start-2P in the desired size
|
||||
return pygame.font.Font("assets/font.ttf", size)
|
||||
|
||||
def show_loading_screen():
|
||||
start_time = pygame.time.get_ticks()
|
||||
loading_image_rect = LD.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2))
|
||||
pygame.mouse.set_visible(False) # Hide the cursor
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
||||
SCREEN.fill((0, 0, 0))
|
||||
SCREEN.blit(LD, loading_image_rect) # Display the loading image
|
||||
pygame.display.update()
|
||||
if pygame.time.get_ticks() - start_time >= 5000:
|
||||
pygame.mouse.set_visible(True) # Show the cursor
|
||||
return
|
||||
|
||||
|
||||
# Display loading screen for 5 seconds before showing main menu
|
||||
show_loading_screen()
|
||||
|
||||
def play():
|
||||
while True:
|
||||
pygame.time.delay(500)
|
||||
import Game_V2
|
||||
# Game_V2 vietāpievienojiet failu ar pabeigto spēli
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def options():
|
||||
volume = 1 # Initial volume
|
||||
slider_height = 20 # Slider height
|
||||
|
@ -40,8 +56,6 @@ def options():
|
|||
SCREEN.blit(BG, (0, 0))
|
||||
OPTIONS_MOUSE_POS = pygame.mouse.get_pos()
|
||||
|
||||
|
||||
|
||||
OPTIONS_TEXT = get_font(45).render("Change Volume", True, "white")
|
||||
OPTIONS_RECT = OPTIONS_TEXT.get_rect(center=(640, 260))
|
||||
SCREEN.blit(OPTIONS_TEXT, OPTIONS_RECT)
|
||||
|
@ -94,9 +108,6 @@ def options():
|
|||
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
|
||||
|
||||
def main_menu():
|
||||
while True:
|
||||
SCREEN.blit(BG, (0, 0))
|
||||
|
|
Loading…
Reference in New Issue