This repository was archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtitleScreen.py
More file actions
44 lines (33 loc) · 1.42 KB
/
titleScreen.py
File metadata and controls
44 lines (33 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pygame
import colors
from fileUtils import load_music, load_image
from textUtils import text_format, MENU_FONT
background_file = 'background_title.png'
main_theme = 'Windom_Earle_07_screw_wave.ogg'
clock = pygame.time.Clock()
def title_screen(screen, screen_rect):
in_title_screen = True
# Load
background_image = load_image(background_file)
main_title_image = load_image('ccc_pumptrack_attack_title.png')
# Main Theme
load_music(main_theme)
pygame.mixer.music.play(-1)
while in_title_screen:
for event in pygame.event.get():
if event.type == pygame.QUIT or event.type == pygame.KEYDOWN:
return
# Draw Background
background_rect = background_image.get_rect()
background_rect.left, background_rect.top = [0, 0]
screen.fill(colors.white)
screen.blit(background_image, background_rect)
main_title_image_rect = main_title_image.get_rect()
main_title_image_rect.center = (screen_rect.size[0] / 2 + 20, screen_rect.size[1] / 2 - 80)
screen.blit(main_title_image, main_title_image_rect)
press_any_key = text_format("Press any key to continue", MENU_FONT, 18, colors.white)
press_any_key_rect = press_any_key.get_rect()
press_any_key_rect.center = (screen_rect.size[0] / 2, 500)
screen.blit(press_any_key, press_any_key_rect)
pygame.display.update()
clock.tick(30)