-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCredits.py
63 lines (51 loc) · 1.58 KB
/
Credits.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pygame
import os
# os.environ["SDL_VIDEO_CENTERED"] = "1" # Center the window
pygame.init()
screen_size = (640,480)
screen = pygame.display.set_mode(screen_size)
clock = pygame.time.Clock()
font = pygame.font.SysFont("helvetica", 23, True)
class Text():
def __init__(self, text, color, y):
self.text = text
self.color = color
self.surf = font.render(self.text, 1, color)
self.size = pygame.Surface.get_size(self.surf)
self.pos = [(screen_size[0]-self.size[0])/2, y]
def scroll(self):
if self.pos[1] > screen_size[1]:
self.pos[1] = 0
self.pos[1] = self.pos[1] + 0.35
def screen_update():
screen.fill((0,0,0))
for text in text_class_list:
screen.blit(text.surf, text.pos)
text.scroll()
pygame.display.flip()
text_list = [
"Hazcoper",
"Made by:",
"",
"",
"Hazcoper",
"Graphics by:",
"",
"lol, cant you see there is no sound?",
"Sounds by:",
]
text_class_list = []
for e in range(len(text_list)-1,-1,-1):
print(text_list[e])
if not text_list[e] == "":
text_class_list.append(Text(text_list[e],(230, 230, 237),e*-25))
running = True
while running:
clock.tick(120)
for event in pygame.event.get():
if event.type == pygame.QUIT: # Quit without Errors
running = False
if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: #Back to main screen
exec(open("MainScreen.py").read())
running = False
screen_update()